struct Location size

Walter Bright newshound2 at digitalmars.com
Wed May 10 20:21:18 UTC 2023


On 5/10/2023 10:16 AM, max haughton wrote:
> I also don't see why its a perf issue?

Every time the line number is needed, the file source has to be scanned from the 
start of the file source. Line numbers are needed not just for error messages, 
but for symbolic debug info. Generally debug compiles should be fast.

Scanning the source files also faults them into memory.

If one does a table of pairs of fileoffsets/linenumbers, that will speed things 
up, but at a cost of 8 bytes per code line. Also the binary search needed for 
referencing it, which will cause the array to be faulted into memory.


More information about the Digitalmars-d mailing list