Andrew Haley
2018-12-10 12:29:39 UTC
My observation is that when “jmap histo” iterating objects , the object’s klass
is identified and then hash idx in KlassInfoTable’s buckets[] is calculated by mod
of _num_bucktes, which would issue a heavy instruction idiv on x86 platform. It
means for every object scanned, a idiv instruction is issued, which lag the performance espically when
there are large number of objects in heap.
I'm surprised that GCC uses idiv in this case: it has an optimization foris identified and then hash idx in KlassInfoTable’s buckets[] is calculated by mod
of _num_bucktes, which would issue a heavy instruction idiv on x86 platform. It
means for every object scanned, a idiv instruction is issued, which lag the performance espically when
there are large number of objects in heap.
constant modulo which doesn't use division. There is sometimes an
advantage for using hash tables of prime size. Is it that the size of
the table is not a constant that GCC can see?
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671