- 
                Notifications
    
You must be signed in to change notification settings  - Fork 205
 
Closed
Description
If you keep a reference to a JS function in a PHP variable (by means of a V8Function object) like so:
$v8 = new V8Js();
$func = $v8->executeString('(function() { print("Hello World\\n"); });');
for($i = 0; $i < 1000; $i ++) {
    $func();
}... the performance is pretty bad: V8Js 0.2.1 takes 2.466s to execute these 1k calls, V8Js 0.1.5 even needs 80s.
Compared to the performance we achieve if executing the functions via executeString like
$v8 = new V8Js();
for($i = 0; $i < 1000; $i ++) {
    $v8->executeString('(function() { print("Hello World\\n"); })();');
}... which even has the disadvantage that the function is compiled over and over again, it just takes 0.168s to run on recent V8Js and 0.247s on older ones.
Metadata
Metadata
Assignees
Labels
No labels