That library rarely does type checking. This contributes a lot of
speed to their overall algorithm. If you look at my benchmarks,
clearly, removing type checking helps, but it doesn't help for all
applications. Another thing is that they use 99% C-style for loops
with numerical indices instead of for-in loops (which always require
some type checking because they work with all Objects and Arrays). The
code actually resembles Asm.js in its heavy use of numbers.
Array#[push|pop]() is easily optimized for array instances, because
they each compile down to a single common assembly instruction. Also,
in the case of Array#pop(), if the value isn't used, then it can
simply pop to the same register over and over again, making it easily
surpass 100 million operations per second if properly optimized.
Back to the initial topic, my main request isn't to remove
type-checking, but to make a special case (or more optimal case) for
Arrays in Array#join(), and especially if it is an array of Strings.
This is a relatively fast snippet of C++ code:
std::string join(std::string* array, int len) {
std::string str = '';
while (len) {
str += *(array + --len);
}
return str;
}
The Fast library could speed up some of their methods easily by
reversing the iteration order for some methods (and I'm about to draft
a quick patch to it).
> --
> --
> v8-users mailing list
>
v8-u...@googlegroups.com
>
http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/v8-users/FoK9X52cIDs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
>
v8-users+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Isiah Meadows