Comment

Comment by gopalv

Reading this code almost makes me want to think about how differently I review Java than C or C++.

  ch = ++index < strlen ? str.charAt(index) : 0;
If I saw that code scattered across in some java code, I would immediately be like - "rewrite please".

But the same code fragment in C would be like - yeah, we need a bounds check, good job, can you make it a macro please.

The java default Float parser was somewhat of a complete perf headache when multi-threading, more than about single core consumption (till jdk8b96 - JDK-7032154), so in the past Hive has shipped with its own strod impl[1] to avoid the central lock in parseDouble.

Also it worked off a raw utf8 byte[] stream, which is more common coming out of a disk file or network serialization rather than a CharSequence.

[1] - https://github.com/apache/hive/blob/4446414f4478091db1eb20bc...

parent gopalv 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton