[PATCH] D93452: [clangd] Trim memory after buildINdex
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 18 03:09:33 PST 2020
njames93 added a comment.
In D93452#2460563 <https://reviews.llvm.org/D93452#2460563>, @sammccall wrote:
> I think we should pass a nonzero `pad` to malloc_trim of several MB. It only affects the main thread, but the main thread is constantly allocating small short-lived objects (e.g. JSON encoding/decoding) and cutting it to the bone only to have it sbrk again seems pointless.
It would require a lot of work, but JSON encoding/decoding is possible without lots of allocations.
If you want to really compress memory usage, losing the map like access, O(1), on json objects, in favour of storing them in a vector, O(n), would be beneficial. I don't think the jsons in clangd ever really have maps with large numbers of keys which are queried often.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93452/new/
https://reviews.llvm.org/D93452
More information about the cfe-commits
mailing list