Updates:
Summary: Handle variable (re)declarations in hot top-level loops better
Labels: Priority-Low
Comment #2 on issue 3194 by [email protected]: Handle variable
(re)declarations in hot top-level loops better
http://code.google.com/p/v8/issues/detail?id=3194
Microbenchmarks are hard. So is variable scoping in JavaScript: your third
case is declaring 1 million global variables with the same name. Consider
this:
print(c); // This is not a reference error, c is perfectly valid here!
while (true) {
var c = 1;
break;
}
print(c); // Prints 1. Of course.
If you wrap all three cases into (anonymous, if you like) functions, they
all exhibit the same speed, and the deopts are gone too (because they have
nothing to do with writing to global variables, only with optimizing the
top level before all parts of it have been executed in unoptimized code).
That said, V8's performance compared to other browsers on this particular
microbenchmark is poor, and arguably we might want to avoid repeated
runtime calls when global variables are declared in loops. Then again this
looks like a pretty contrived cornercase, so I'm not sure it's worth the
effort.
I'm tempted to close this as WAI, but we can also keep it open in case
someone gets bored.
--
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/groups/opt_out.