You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Micro-optimize code size of /proc/maps parsing code
The current code size is really wastefully large. Originally, it was
1500 lines of assembly in Godbolt, now I reduced it to just under 800.
The effect of `.text` size in hello world is from 297028 to 295453 which
is small but not completely irrelevant. It's just a small fish in the
bigger pond of DWARF parsing, but it's better than nothing.
I extracted the parsing of each component into a separate function to
allow for better sharing. I replaced the string methods with manual
iteration since that results in simpler code because it has to handle
fewer cases. I also had to use unsafe because the bounds checks were
sadly not optimized out and were really large.
I also made the parser less resilient against whitespace, now it no
longer handles Unicode whitespace (an obvious simplification) but also
no longer handles any whitespace except the normal SP. I think this is
fine, it seems highly unlikely that a system would suddenly use another
type of whitespace (but I guess not impossible?).
0 commit comments