3 ms·
When I said main memory I meant failing to get a cache hit. If you’re hitting the allocator (slow!) then odds are pretty good those bytes aren’t fresh in the c
by forrestthewoods 8y ago
When I said main memory I meant failing to get a cache hit.
If you’re hitting the allocator (slow!) then odds are pretty good those bytes aren’t fresh in the cache. They could be if you just read them and then freed them and then the allocator handed them right back. But that’s probably not a good pattern either.
Another form of this pattern is the small string optimization. It’s exceptionally common. https://blogs.msmvps.com/gdicanio/2016/11/17/the-small-string-optimization/ https://blogs.msmvps.com/gdicanio/2016/11/17/the-small-strin...
- chrisseaton 8y ago> If you’re hitting the allocator (slow!) then odds are pretty good those bytes aren’t fresh in the cache. Incidentally, this is a great reason why GCs are useful even if you don't need the automatic memory management - a GC can allocate from memory that is always in cache, and they can do it in a couple of cycles.
- deleted 8y ago[deleted]