I am writing a code that will parse a huge number of 32bit integers from a
binary chunk and do some math I need.
I coded it in JS (node.js 0.3.x with V8 3.x), and the calculations took
about 1 minute. Then I rewrote the main cycle in C++ module to speed it u
and it took... about 5 min. Here's a snippet of code that is running in C++
context, something like that:
HandleScope scope;
Local<Array> js_result = Array::New();
int i=0;
for(i=0;i<size;i++) {
int off=i*4;
Local<Array> js_entry = Array::New();
js_entry->Set(Integer::New(q), Number::New(ticks[off]));
js_entry->Set(Integer::New(q+1), Number::New(ticks[off+3]));
js_entry->Set(Integer::New(q+2), Number::New(ticks[off+2]));
scope.Close(js_entry);
js_result->Set(Number::New(i), js_entry);
}
return scope.Close(js_result);
Does it mean that calls from C++ to create V8 JS objects are expensive?
Integer::New() and so alike?
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users