Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×

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

by viperidaenz (#49340181) Attached to: Developers and the Fear of Apple

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) 485

by viperidaenz (#49337619) Attached to: No, It's Not Always Quicker To Do Things In Memory

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.

To downgrade the human mind is bad theology. - C. K. Chesterton

Working...