-
-
Notifications
You must be signed in to change notification settings - Fork 12
Description
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.
TaskGroup.addTask
TaskGroup.createTask
TaskGroup.itemCompletionCallback
Task
Task.completionCallback
ambi
and others like
b (minification rocks lol)
setImmediate gets kicked as well
(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 the arguments
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:
args=[]
args.push arg for arg in arguments
or when their are static items on the stack too i.e. (item1, item2, args...)
then
args=[]
args.push arg for arg in [2...arguments.length]
Love to hear your thoughts..