diff options
author | Eric Wong <e@80x24.org> | 2024-06-06 07:44:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-06-07 00:39:47 +0000 |
commit | d116a7856c8c3d00af2924ba536afc76f6874062 (patch) | |
tree | 56ae169771c18b5cc5d1b48c13aeef4743a6d327 /lib/PublicInbox/IdxStack.pm | |
parent | 13f9a501739f35e2dd69be14788b6aca7b5a02a8 (diff) | |
download | public-inbox-master.tar.gz |
For giant threads with /t/ and /T/ endpoints, avoid generating a large string with a medium lifetime for the thread skeleton ($ctx->{skel}). Instead, make $ctx->{skel} an arrayref and use it to store a bunch of smaller strings, instead. While keeping many small strings is inefficient due to pointer chasing; forcing a smaller distribution of sizes makes it easier for the malloc implementation to organize and find small chunks of memory instead of having to find (and hold) larger contiguous chunks. When a large string is created now, it's lifetime is kept as short as possible to decrease its likelyhood of causing fragmentation. Preliminary testing shows this appears to reduce RSS by roughly 20-40% under both glibc malloc (using a tiny MALLOC_MMAP_THRESHOLD_=67000) on 32-bit and jemalloc 5.2.1 on 64-bit with standard settings.
Diffstat (limited to 'lib/PublicInbox/IdxStack.pm')
0 files changed, 0 insertions, 0 deletions