I have code in Javascript that sends an object to my node v8 C++ add-on 
module. I want to iterate through the keys and values of that object in 
C++. Currently I do this:

    Local<Object> pt = args[0].As<Object>();

    v8::Local<v8::Array> keys = pt->GetOwnPropertyNames();
    uint32_t length = keys->Length();
    for (u_int32_t i = 0; i < length; ++i) {
        v8::Local<v8::Value> key = keys->Get(i);
        v8::Local<v8::String> key_str(key->ToString());
        v8::String::Utf8Value tag(key_str);
        v8::String::Utf8Value val(pt->Get(key_str));
    // do stuff with tag and val
    .......

The calls to keys->Get() and pt->Get() are so, so, so slow: profiling 
reveals that just those two lines take 70% of the runtime of my 
application. Is there a better way to do this? My searching came up with 
GetIndexedPropertiesExternalArrayData, but apparently that's gone now.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to