On Fri, 28 Apr 2023 19:30:43 GMT, Neal Gafter <d...@openjdk.org> wrote:

> Building a map or hash table will be faster than sequential search.

I agree it there will be usecases (and maybe even a majority of usecases) where 
using some kind of hash-based structure would work better than this patch. 
However, as Remi points out:
 - we cannot generally create a hash map just from the labels, as the inputs 
may be arbitrary subtypes of the label types. This means the hash-based 
structure would be (in a sense) a cache
 - the queries may be (massively) concurrent
 - the hash-based structure should not prevent class unloading (as the input 
classes may generally originate in arbitrary ClassLoaders)

And while a lot of this may not be an issue for a majority of usecases, there 
must be some support for the minority usecases.

There may be also be a subset of the usecases where VM's ability to see through 
the code an optimize it would have more impact than having clever code that's 
more difficult to understand. This may need much more testing to see if it is 
possible to distinguish these various cases.

The current proposal improves the performance, but does not preclude 
improvements in the future - this is a runtime part, which we can adjust over 
time, as needed.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/9779#issuecomment-1531339312

Reply via email to