Hi Andrej,

this seems like a very reasonable improvement. I can help sponsor it.

What I think is really needed in this area is some microbenchmarks that sets up multiple and more complex (but somewhat realistic) Layers of modules and test various queries, so that we can profile and get a tab on where improvements matter most.

Thanks!

/Claes

On 2017-12-07 11:00, Andrej Golovnin wrote:
Hi all,

when we try to find a module which is not in the current layer, then
we access the map 'nameToModule' in the parent layers two times in the
lines 849-850:

846        return layers()
847                   .skip(1)  // skip this layer
848                   .map(l -> l.nameToModule)
849                   .filter(map -> map.containsKey(name))  // <-- first access
850                   .map(map -> map.get(name))                // <--
second access
851                   .findAny();

This can be improved when we map to the module in the line 848 and
then filter for non-null values:

846        return layers()
847                   .skip(1)  // skip this layer
848                   .map(l -> l.nameToModule.get(name))
849                   .filter(Objects::nonNull)
850                   .findAny();

The suggested change is attached as diff.

Best regards,
Andrej Golovnin

Reply via email to