RFR: JDK-8326586: Improve Speed of System.map [v2]
Gerard Ziemski
gziemski at openjdk.org
Wed Feb 28 15:38:55 UTC 2024
On Wed, 28 Feb 2024 06:29:01 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/nmt/memMapPrinter.cpp line 137:
>>
>>> 135: if (to <= _ranges[last].from) {
>>> 136: // not sequential? restart at 0
>>> 137: last = 0;
>>
>> If we know that the current region is to the right of the given section, couldn't we just start moving to left, one region at the time, instead of re-starting at 0?
>>
>> This would be an optimization on top of your optimization, but since we are already touching this might as well consider it?
>
> But we don't know how far away the target entry is. We know it precedes the current entry, but not the distance. This is purely theoretical, since in all scenarios we use this class for the input source is sorted. Therefore we cannot predict any likelihood of being "somewhat sorted".
>
> And then, I have the nagging feeling that searching backward would be less cache-friendly. Since there is no pro, and only one possible con, I'd opt for keeping it this way.
Yeah, my assumption here was that the sections are somewhat ordered, as per your assumption (which is why your optimization is useful) AND that this miss is closer to the cached index, than 0 (which is unverified assumption on my part).
You would know the best, so if you don't feel like it's worthwhile then I'm OK with that - just wanted to point out this potential additional improvement.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17984#discussion_r1506160635
More information about the hotspot-runtime-dev
mailing list