[
https://issues.apache.org/jira/browse/SOLR-13533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16859582#comment-16859582
]
Koen De Groote commented on SOLR-13533:
---------------------------------------
Hello Varun,
Linking the PRs here is a good idea, I will do that.
The first thing I happened to come across is usage of StringBuilder where at
some point regular concatenation is used as part of an append.
So, something like:
{code:java}
StringBuilder sb = new StringBuilder();
sb.append("Hello, " + "World!");
{code}
Which defeats the very purpose of using a StringBuilder. And also it causes the
internal construction of extra StringBuilder objects by the JVM. And the JVM is
very conservative with that optimization. It does no interpretation, no
recognizing that there is already a StringBuilder present and adding it to that
one.
It is true that for simple concatentation, StringBuilder isn't required. But
when it is already being used, then using append for everything is the best
option.
PR for that is here: [https://github.com/apache/lucene-solr/pull/707]
It's encompasses 103 files across the entire codebase, which is kinda large.
That being said, it is exclusively about that 1 single change. Tests have run,
all succeed.
The name's "Koen" by the way :P
> Code Cleanup - Performance
> --------------------------
>
> Key: SOLR-13533
> URL: https://issues.apache.org/jira/browse/SOLR-13533
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Koen De Groote
> Priority: Trivial
> Labels: performance
>
> Code cleanup as suggested by static analysis tools. Will be done in my spare
> time.
> If someone reviews this, please also do not take up actual time from your
> work to do that. I do not wish to take away from your working hours.
>
> These are simple, trivial things, that were probably overlooked or not even
> considered(which isn't an accusation or something negative). But also stuff
> that the Java compiler/JIT won't optimize on its own.
>
> That's what static analysis tool are good for: picking stuff like that up.
>
> I'm talking about Intellij's static code analysis. Facebook's "Infer" for
> Java. Google's "errorprone", etc...
> These are the kinds of things that, frankly, for the people actually working
> on real features, are very time consuming, not even part of the feature, and
> have a very low chance of actually turning up a real performance issue.
> So I'm opting to have a look at the results of these tools and implementing
> the sensible stuff and if something bigger pops up I'll make a separate
> ticket for those things individually.
>
> Creating this ticket so I can name a branch after it.
>
> The only questions I have are: since the code base is so large, do I apply
> each subject to all parts of it? Or only core? How do I split it up?
> Do I make multiple PRs with this one ticket? Or do I make multiple tickets
> and give each their own PR?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]