Hacker News new | ask | show | jobs
by amelius 27 days ago
Decimal strings are for human consumption, I suppose. Not sure if the nanosecond timescale is relevant then (unless you send these numbers to billions of people which is unlikely). Sounds like a pointless exercise, or maybe they should have picked a better example.
5 comments

Wow that’s a bit harsh. You can’t think of any examples where you may need to send a string to something but want to do it quickly?
Yeah maybe a bit harsh. But the point is if you are looking for that kind of performance, I don't see why you wouldn't send binary data and then unpack it as needed.
If you control both ends of the pipe, then sure. But for better or worse, large chunks of infrastructure expect to send or receive JSON.
csv/tsv are alive & well for interorg data pipelines
But JSON uses floats, not integers.
Does it really? I assumed it used strings.
javascript uses floats as its own default numeric data type; but other languages do have integers, and might want to convert those integers into a JSON (string) representation
Because maybe the choice of serialization format isn't under your control?
I do sort of agree that, at some point, there arrives a question of “are we sure we need to convert the ints to strings?” But it also serves as a convenient excuse to write fast AVX-512 code (practice and show off tricks if nothing else), the objective is immediately obvious (no need for intense numerical proofs). I like it.
Many large distributed systems are built around pushing data through web requests, and human readable request/response formats (JSON, XML) are the most popular, and require integer to string conversions for serialization.
I can imagine a time in the near future when the conversion of integers to decimal strings becomes a limit to the rate at which AI can generate text that's not worth reading.
You assume that human consumption means immediate human consumption.

By this metric, there's no need for video encoders faster than the movie's own FPS, either.