5 ms·
>which means Java has many excellent state-of-the-art garbage collectors and a JIT a level beyond that of C#. Unfortunately this isn't enough to make up for th
by logicchains 6y ago
>which means Java has many excellent state-of-the-art garbage collectors and a JIT a level beyond that of C#.
Unfortunately this isn't enough to make up for the latency hit from not being able to directly stack allocate things like C# allows (especially with its recent addition of Span<T>).
- chrisseaton 6y ago> make up for the latency hit from not being able to directly stack allocate things Java does better than direct stack allocation - it does automatic scalar replacement instead.
- logicchains 6y agoCan automatic scalar replacement turn my ArrayList<Pair<Long, Double>> into the equivalent of std::array<std::pair<int64_t, double>, N> (or Span<Tuple<long, double>>)?
- chrisseaton 6y agoIt doesn't turn it into the equivalent of another data structure, and it doesn't allocate it on the stack, that's why it's better. It turns each value in the collection into a dataflow edge which then goes into a register, or the stack, or anywhere.
- inamiyar 6y agoThis seems really interesting, do you have any sources I can look into for more information along these lines?
- gpderetta 6y agoso does any decent compiler. But to do that in java you first have to prove it is safe, which is hard.