[PATCH] D45003: [Support] Make line-number cache robust against access patterns.

Graydon Hoare via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 23:52:52 PDT 2018


graydon added a comment.

Did a bit more precise measurement: on a medium-sized module (802 files, 200kloc) when we're doing -emit-module for a whole module (which turns out to map _every file_ in order to get doc-comment locations, when it's emitting module docs) the normal compilation uses 191MB RSS and these maps account for 3.3MB of that (1.7%). Largest map is 32KB, median is 4KB. Not trivial, but not huge.

However, in those cases it also represents a more-noticeable speedup: 271s -> 267s (and 925bn instructions -> 918bn).

Given that the majority of the files are quite small -- certainly smaller than 2^64 bits! -- I've made a variant that uses variable size offsets (8, 16, 32 or 64 bit) rather than pointers. That variant uses only 956KB for the indexes in that testcase (with 200kloc / 191MB RSS). I think that's about as memory-cheap as I can make it using this approach.


Repository:
  rL LLVM

https://reviews.llvm.org/D45003





More information about the llvm-commits mailing list