Skip to content

disabled optimisation issue: "bad value context for arguments value" #12

@pflannery

Description

@pflannery

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..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions