-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disabled optimisation issue: "bad value context for arguments value" #12
Comments
Didn't know about it. Definitely is a problem. I wonder if we can report it to the coffeescript team and get them to fix it at the source. |
I've reported it to joyent. setImmediate seems to be a lot slower than processTick and it's also quite a bit slower than setTimeout. I wondered why chrome gets away with it and turns out they run all their timers through c++ instead of js and just exposes the timer methods. Maybe that's something node should do in the long run too. |
@balupton I think your right maybe something we can convince the coffee team @jashkenas@michaelficarra to change the output code for I was reluctant to ask at first as it seemed like this would be a V8 only scenario but I've done two benchmarks showing that small array copying is faster (plus we would get the benefit of V8 optimisation) |
Does calling |
thanks for your reply @michaelficarra, unfortunately it does the same.. this is my test app.js function TestOptimization(a,b,c,d,e) {
var target = [].slice.call(arguments);
};
// because V8 trace uses a sampler that
// periodically samples the state of the VM
// I'm calling this method 150 times
// on my pc to capture the trace message
// Put this higher if you don't see the trace info
for(var i=0;i<150; i++)
TestOptimization(1,2,3,4,5); then I'm running this to capture the optimisation trace messages
outputs
|
Okay, please open an issue at jashkenas/coffee-script. |
Gonna close this, as this is something that coffeescript or v8 will need to fix. |
Re-opening, as this is unacceptable, even if it is not our responsibility. |
Closed with v5.0.0 - https://github.com/bevry/taskgroup/blob/master/HISTORY.md#v500-2016-june-4 |
I've found something interesting that you may already be aware of.
The following functions all get immediately disabled for optimisation by the V8 compiler when arguments are passed to them.
(On top of testing with node 0.10.22, v8 3.14.5.9, I've also tested the code with V8 version 3.23.6 using the d8 compiler and it still disables optimisation for this scenario.)
Pretty much everywhere that has
args...
causes V8 to immediately disable the functions from optimisation. It seems to be something to do with slice and\or passing thearguments
variable to another method inside the calling method.There is a way around this where by making a copy of the arguments manually which lets us get V8 optimization.
Workaround example:
or when their are static items on the stack too i.e.
(item1, item2, args...)
thenLove to hear your thoughts..
The text was updated successfully, but these errors were encountered: