Live data from Hacker News

Flotsam: Insanely Fast Floating-Point Number Serialization for Java, Javascript

blog.factual.com

1–10 of 12 posts

Re: Flotsam: Insanely Fast Floating-Point Number Serialization for Java, Javascript

#4
Sort of similar to this base64 encoder I wrote to speed up ThreeJS float data streams. Seems more complex though that the stuff that I did.

I had good performance gains versus JSON as evidenced by this popular JSPref:

http://jsperf.com/json-vs-base64

Re: Flotsam: Insanely Fast Floating-Point Number Serialization for Java, Javascript

#5
post #3

[deleted]

That's a definite possibility. We went with base-94 because it avoids UTF-8 overhead in situations where the browser will treat your data as a string (e.g. no typed-array support). We also wanted copy/paste to work, and for Flotsam data to be embeddable into JSON with minimal expansion.

Re: Flotsam: Insanely Fast Floating-Point Number Serialization for Java, Javascript

#7
post #6

This could open up some nice possibilities for browser based and Node.js driven distributed computing.

Could you elaborate? I don't see the application, JS is still ghastly slow in comparison to C.

Compile to asm.js?

Re: Flotsam: Insanely Fast Floating-Point Number Serialization for Java, Javascript

#9
This is a problem that only "walled garden" languages like Java and JavaScript would ever even have in the first place. If you're not trapped in a gilded cage, you just print raw bytes directly to a socket and then read data back the same way. The only concern is byte ordering, which is easy.

Regarding this specific approach, "only 20% overhead" sounds pretty good, but base 64 encoding has "only 33% overhead", is completely general, and likely already has faster implementations than this.

Re: Flotsam: Insanely Fast Floating-Point Number Serialization for Java, Javascript

#10
post #7
post #6

Earlier quoted context omitted.

Could you elaborate? I don't see the application, JS is still ghastly slow in comparison to C.

Compile to asm.js?

Right then why would you ever even use this library instead of a typed byte array? ASM.JS isn't needed for typed arrays, besides its only supported on FF.
Post reply on HN