Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Comment Re:Crap !!!!! (Score 1) 269

But what was RS's revenue and net profit?
Apple just posted $18bn in net profit over 3 months. That was in an article titled "US technology giant Apple has reported the biggest quarterly profit ever made by a public company."

They're pulling in 182 billion a year in sales. Their revenue is bigger than the GDP of my country.

If they were a country, their net profit puts them at 91 when compared to the profit of countries.

How do you compare Apple to RS, who have been losing millions every year for many years.
Their last profit was back in 2011, at $72M, 2012 was a loss of $140M and $400M loss in 2013

Comment Your code sucks (Score 2) 486

String concatString = "";
  for (int i=0; i numIter; i++) {
  concatString += addString;
  }

That's going to create 1,000,000 StringBuilder objects, use them to append a single String each, and allocate 1,000,000 new String objects as well

StringBuilder builder = new StringBuilder(
  for (int i = 0; i numIter; i++) {
  builder.append(addString);
  }
String concatString = builder.toString();

I bet $1,000,0000 that code is faster.

tl;dr; Researchers who don't know who Java works suck at writing Java benchmarks.
String a = b + c;
gets translated by the compiler to something like:
String a = new StringBuilder(a).append(b).toString();

It's creating a new StringBuilder object, its member variables including a char array, it copies the String passed in to the constructor. Append is probably also expanding the array, which means creating a new array and copying the old one to the new one, then copying the data from b to the end of the new array.
toString then creates a new String object, copying the data again.

If you write shit code, you get shit performance.

Slashdot Top Deals

"The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde

Working...