Every Byte Matters
fzakaria.com
Every Byte Matters
1–10 of 159 posts
Re: Every Byte Matters
#2Re: Every Byte Matters
#3Re: Every Byte Matters
#4So if you need speed, you just have to swallow your OO programmer's pride and put your data in arrays.
mild /s
Re: Every Byte Matters
#5The JVM is an odd place where it requires too much heap to compete with the AOT compiled languages, but its startup time is too slow compared to interpreted languages. I think these enhancements are essential to keep the platform relevant.
Re: Every Byte Matters
#6Re: Every Byte Matters
#7Re: Every Byte Matters
#8Re: Every Byte Matters
#9Most developers, in Java and in most other languages, do not consider the cost of every field, but I can tell you that people who need micro-optimisations certainly do care, and in Java's standard library, a layout is very much a concern (except, as always, you want to optimise what really matters; there's no point in optimising something that is unlikely to be a hot spot in a real program). Sometimes, though, you want to intentionally spread out the layout to avoid cache line sharing when concurrency is involved. You will find such examples in the standard library, too.
Re: Every Byte Matters
#10The JVM is currently pretty bad for memory allocation. Every object (i.e. not a primitive) has a header that IIRC is 12 bytes. But there is good news in JVM land: this will be reduced to 8 bytes in the next JVM release, and Project Valhalla will give the tools to do away with headers entirely in some cases. Project Valhalla also has tools to manage off-heap memory, which is important in many cases. The JVM is an odd…