I'm not sure Sun/Oracle ever formally specified this behavior, but as a JVM
engineer since Java 0.98 I can attest to it. This behavior is also
described in JEP-280: "Currently javac translates String concatenation into
StringBuilder::append chains" (referring to Java 8).
The advantages of using St
What performance tests are define to help in determining before and after
performance improvements?
Eric Bresie
ebre...@gmail.com
On Sat, Dec 14, 2024 at 9:08 AM Serw wrote:
> Dear Apache Commons Community,
>
> In my recent PR #1332, I replaced a StringBuilder usage with string
> concatenation
On Sun, Dec 15, 2024 at 2:00 PM Peter Burka wrote:
>
> Before Java 9, javac always generated StringBuilder calls for string
> concatenation (or StringBuffer prior to Java 2). Using + is less verbose,
> generates the same code, is more readable, and, when we do finally bump the
> compile target, wi
Before Java 9, javac always generated StringBuilder calls for string
concatenation (or StringBuffer prior to Java 2). Using + is less verbose,
generates the same code, is more readable, and, when we do finally bump the
compile target, will generate better code.
Peter
On Sun, Dec 15, 2024, 7:13 AM
Thanks. In that case I'm -1 on this since it is not available in Java
8, and even in Java 9 is only possible, not necessarily implemented.
We can revisit in a few years if the JDK has moved on by then.
On Sun, Dec 15, 2024 at 1:05 AM Peter Burka wrote:
>
> I presume this is referring to
> https:
I presume this is referring to
https://openjdk.org/jeps/280 (JEP 280: Indify String Concatenation) which
was implemented in Java 9.
On Sat, Dec 14, 2024, 6:26 PM Elliotte Rusty Harold
wrote:
> On Sat, Dec 14, 2024 at 3:08 PM Serw wrote:
>
> > Would the community support using string concatenat
On Sat, Dec 14, 2024 at 3:08 PM Serw wrote:
> Would the community support using string concatenation over StringBuilder
> for simple cases? Modern JDKs (8+) optimize string concatenation
> efficiently, making it both concise and performant.
Interesting. Do you have a reference for that?
--
Ell
On Sat, Dec 14, 2024 at 1:56 PM Piotr P. Karwasz
wrote:
>
> Hi Gary,
>
> On 14.12.2024 17:45, Gary Gregory wrote:
> > What passes the criteria of "simple cases"?
>
> I would classify all sequences of `new StringBuilder()`, `append` and
> `toString` without any branching or loops as simple cases.
Hi Gary,
On 14.12.2024 17:45, Gary Gregory wrote:
What passes the criteria of "simple cases"?
I would classify all sequences of `new StringBuilder()`, `append` and
`toString` without any branching or loops as simple cases.
Should this be enforced or can it be enforced? With Checkstyle? Som
Hi Serw,
On 13.12.2024 22:08, Serw wrote:
Would the community support using string concatenation over StringBuilder
for simple cases? Modern JDKs (8+) optimize string concatenation
efficiently, making it both concise and performant.
Since the Javac compiler replaces string concatenation with
Hello serwserw...@gmail.com,
Thank you for your email.
Here are a few questions:
What passes the criteria of "simple cases"?
Should this be enforced or can it be enforced? With Checkstyle? Somethings
else?
Considering:
- that we support Java 8 and up to the current version.
- that we don't say
11 matches
Mail list logo