Hacker News new | ask | show | jobs
by igouy 5054 days ago
>> FUBARed the Java implementation <<

    // deliberately *not* using StringBuffer / StringBuilder,
    // as a real app would have many transient string variables
1 comments

Because I know that every corporate app dev is (NOT) going to write:

   StringBuilder buf = new StringBuilder( s1);

   buf.append( s2);

   String cat = buf.toString();
instead of:

   String cat = s1 + s1;
in their application code. (although I think that is pretty much what the compiler generates on your behalf, anyway)

The loop is in the benchmark so I don't have to write code dealing with many different string values of differing size manually.