[ 
https://issues.apache.org/jira/browse/SOLR-14579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17141860#comment-17141860
 ] 

Andrzej Bialecki commented on SOLR-14579:
-----------------------------------------

That's only partially true because HotSpot _may_ inline this type of classes - 
the key word being "may" because it depends on a number of factors. See eg. 
[here|[https://stackoverflow.com/questions/54957772/lambda-performance-improvement-java-8-vs-11]].

It's probably safer to use these static lambdas due to their predictable 
behavior, because then we don't have to worry about the current depth of 
inlining or the exact JVM version.

I see these static instances in Utils as a tradeoff between performance in 
critical sections, and code elegance and readability. So I would keep them here 
- but I wouldn't go and replace all lambdas with these (ugh), just the ones in 
critical sections where performance matters the most.

Maybe we should add some javadoc to clarify their purpose?

> Remove SolrJ 'Utils' generic map functions
> ------------------------------------------
>
>                 Key: SOLR-14579
>                 URL: https://issues.apache.org/jira/browse/SOLR-14579
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: master (9.0)
>            Reporter: Megan Carey
>            Assignee: Noble Paul
>            Priority: Minor
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Remove the map functions like `NEW_HASHMAP_FUN` from the Utils class in solrj 
> module to reduce warnings and improve code quality.
> [https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/common/util/Utils.java#L92]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to