Live data from Hacker News

Show HN: Fast.js – faster reimplementations of native JavaScript functions

github.com

1–10 of 168 posts

Re: Show HN: Fast.js – faster reimplementations of native JavaScript functions

#5
post #2

Some V8 people here ? how can a JS re-implementation be faster than the native implementation of a function ?

From TFA:

    native functions often have to cover complicated edge cases from the ECMAScript specification [...] By optimising for the 99% use case, fast.js methods can be up to 5x faster than their native equivalents.

Re: Show HN: Fast.js – faster reimplementations of native JavaScript functions

#7
post #2

Some V8 people here ? how can a JS re-implementation be faster than the native implementation of a function ?

This is mentioned in the readme: https://github.com/codemix/fast.js#how

The two functions do not necessarily work the same way - the native implementation handles edge cases that the fast version drops.

Re: Show HN: Fast.js – faster reimplementations of native JavaScript functions

#9
post #2

Some V8 people here ? how can a JS re-implementation be faster than the native implementation of a function ?

author of the library here. The native implementations have to follow the spec exactly, which means that they have to guard against specific edge cases. The reimplementations in fast.js do not follow the spec exactly, they optimise for 99.9% of use cases and totally ignore the 0.1%. This, combined with the fact that the JS is JITed straight into machine code anyway gives fast.js a significant advantage - it does less work and so is faster.

Re: Show HN: Fast.js – faster reimplementations of native JavaScript functions

#10
post #2

Some V8 people here ? how can a JS re-implementation be faster than the native implementation of a function ?

They're non compliant - it's a meaningless comparison as the two implementations do different things.
Post reply on HN