Comment #5 on issue 3337 by [email protected]: Not caching map
transitions when using SetIndexedPropertiesToExternalArrayData()
http://code.google.com/p/v8/issues/detail?id=3337
This has a few Node-ism's, because that's what I've used to compile the
thing, but the basic point is there:
main.cc
--------
#include <v8.h>
#include <node.h>
using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::Object;
using v8::Value;
using v8::kExternalUnsignedIntArray;
// Here's the function that will be running
void RunMe(const FunctionCallbackInfo<Value>& args) {
args[0].As<Object>()->
SetIndexedPropertiesToExternalArrayData(NULL,
kExternalUnsignedIntArray, 0);
}
void init(Handle<Object> exports) {
NODE_SET_METHOD(exports, "runMe", RunMe);
}
NODE_MODULE(addon, init)
run.js
------
var runMe = require('./build/Release/addon').runMe;
for (var i = 0; i < 1e7; i++) {
var b = {};
runMe(b);
// Adding this one object property more than triples execution time
//b.length = 0;
}
Run without setting b.length:
$ /usr/bin/time /var/projects/node/node run.js
1.62user 0.15system 0:01.76elapsed 100%CPU (0avgtext+0avgdata
24236maxresident)k
0inputs+0outputs (0major+159394minor)pagefaults 0swaps
And with setting b.length:
$ /usr/bin/time /var/projects/node/node run.js
6.23user 0.28system 0:06.48elapsed 100%CPU (0avgtext+0avgdata
54836maxresident)k
0inputs+0outputs (0major+261784minor)pagefaults 0swaps
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" 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.