Live data from Hacker News

Binary data processing in JavaScript

blog.varunkumar.me

1–10 of 32 posts

Re: Binary data processing in JavaScript

#3

This test should also add strings where the least significant byte of each character is used a byte (i.e. '\x00' = 0 up through '\xff' = 0xff). For many operations, these end up being faster than arrays of numbers.

But, the immutable nature of strings should slow down the whole conversion right? Correct me if I am wrong.

Re: Binary data processing in JavaScript

#4
Hmm, I must have a differing understanding of 'support'

  Global user stats*:Support:	52.22%
Yet no version of IE supports it, that ranks support close to 0% IMO.

I'm no IE lover, but lots of users still have it as their main browser.

Re: Binary data processing in JavaScript

#5
post #4

Hmm, I must have a differing understanding of 'support' Global user stats*:Support: 52.22% Yet no version of IE supports it, that ranks support close to 0% IMO. I'm no IE lover, but lots of users still have it as their main browser.

> I must have a differing understanding of 'support'

One which makes no sense apparently.

> Yet no version of IE supports it

Which is why global user support is 52%: 48% of users have browsers which do not implement typed arrays.

Re: Binary data processing in JavaScript

#6
Couple of things to be aware of from a V8 perspective:

- to make "creation" test more fair for normal arrays they should be preallocated with new Array(arraySize), if arraySize does not exceed 90000. This will ensure that you are not wasting time reallocating backing store as it grows.

- It has been pointed to the test author a year ago that having a single test_SMTH function and calling it with different array types causes it to become polymorphic --- which affects the generated code. V8 became much-much better in handling polymorphism of this sort, but if you'll create a test_SMTH_ARRAYTYPE for each combination of test and array type you'll see results not distorted by the polymorphism.

Re: Binary data processing in JavaScript

#7
post #4

Hmm, I must have a differing understanding of 'support' Global user stats*:Support: 52.22% Yet no version of IE supports it, that ranks support close to 0% IMO. I'm no IE lover, but lots of users still have it as their main browser.

Its 52.22% after considering the usage of IE. Otherwise, it would have 90+

Re: Binary data processing in JavaScript

#8
post #6

Couple of things to be aware of from a V8 perspective: - to make "creation" test more fair for normal arrays they should be preallocated with new Array(arraySize), if arraySize does not exceed 90000. This will ensure that you are not wasting time reallocating backing store as it grows. - It has been pointed to the test author a year ago that having a single test_SMTH function and calling it with different array types…

Thanks for pointing out these things. I will amend the test and try to re-run these cases.

Re: Binary data processing in JavaScript

#9
post #4

Hmm, I must have a differing understanding of 'support' Global user stats*:Support: 52.22% Yet no version of IE supports it, that ranks support close to 0% IMO. I'm no IE lover, but lots of users still have it as their main browser.

> I'm no IE lover, but lots of users still have it as their main browser.

About as many users have browsers that support typed arrays as those who don't.

> Yet no version of IE supports it, that ranks support close to 0% IMO.

While the former is true, I don't see how you came to the latter.

Re: Binary data processing in JavaScript

#10
post #6

Couple of things to be aware of from a V8 perspective: - to make "creation" test more fair for normal arrays they should be preallocated with new Array(arraySize), if arraySize does not exceed 90000. This will ensure that you are not wasting time reallocating backing store as it grows. - It has been pointed to the test author a year ago that having a single test_SMTH function and calling it with different array types…

Any idea as to how other JS engines handle polymorphism?
Post reply on HN