Good afternoon friends,
In the process of trying to optimize our Javascript code running on
Chrome/v8cgi we have stumbled upon what seems like counter-intuitive
results. Basically, in certain cases we see that adding code to a function
makes it faster (specifically, we are adding a call to a function that does
very little work and then returns). Also, we see significant jumps in the
time it takes to run a function even when we make very minor changes to it.
To illustrate, here is a schematic representation of our functions and
timings:
function f1(x) { // this takes 80 microseconds
// do some work
}
function f2(x) { // this takes 60 microseconds
assert(x !== 0);
// do some work (same work)
}
function f3(x) { // this takes 80 microseconds
if (x === 0)
ufu();
// do some work (same as before)
}
We're pretty confused. Could this be because of some optimizations done in
V8 based on the length of functions or any other similar thing? Is there
anything we can do to help us understand this?
Thanks in advance,
Avital.
asana.com
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users