"faster way to convert byte array to int" Code Answer


if i remember correctly, that implementation uses unsafe code (treating a byte* as an int*), so it will be hard to beat, but the other alternative is shifting.

however, from lots of work in this area, this is so unlikely to be a genuine bottleneck as to be irrelevant. i/o is the main issue, typically.

getbytes(int), however, is more expensive (in high volume) due to array / heap allocation.

By sergicurtu on January 13 2022

Answers related to “faster way to convert byte array to int”

Only authorized users can answer the Search term. Please sign in first, or register a free account.