forked from xxq250/Nasal-Interpreter
bug fixed & more efficient callfv
I changed callfv's way of calling a function with arguments in vm_vec. now callfv fetches arguments from val_stack directly,so it runs test/fib.nas from 2.4s to 1.9s. delete operand callf,add operands callfv & callfh. also,i check val_stack's top to make sure there is not a stack overflow.
This commit is contained in:
@@ -137,7 +137,7 @@ while(error>0.0005)
|
||||
}
|
||||
cnt+=1;
|
||||
show+=1;
|
||||
if(show==300)
|
||||
if(show==350)
|
||||
{
|
||||
show=0;
|
||||
print('epoch ',cnt,':',error,'\r');
|
||||
|
||||
@@ -5,4 +5,5 @@ var fib=func(x)
|
||||
return fib(x-1)+fib(x-2);
|
||||
}
|
||||
for(var i=0;i<31;i+=1)
|
||||
print(fib(i),'\n');
|
||||
print(fib(i),'\n');
|
||||
|
||||
Reference in New Issue
Block a user