From: "Jürgen Strobel" Date: 2006-08-08T21:18:16+09:00 Subject: Re: For performance, write it in C --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 27, 2006 at 09:26:45AM +0900, David Pollak wrote: > On 7/26/06, Chad Perrin wrote: > >On Thu, Jul 27, 2006 at 12:42:46AM +0900, David Pollak wrote: > > > > > >> > >> There are some applications that will never perform as in Java (e.g., > >> stuff that's heavily oriented to bit manipulation.) But for many > >> classes of applications (e.g., spreadsheets) Java can perform as well > >> as C. > > > >Is that heavily optimized Java vs. "normal" (untweaked) C? >=20 > No. That's heavily optimized Java vs. heavily optimized C. I spent a > fair amount of time chatting with the Excel team a while back. They > cared as much about performance as I did. They spent a lot more time > and money optimizing Excel than I did with Integer. They had far more > in terms of tools and access to compiler tools than I did (although > Sun was very helpful to me.) >=20 > What was at stake was not someone's desktop spreadsheet, but was the > financial trader's desk. Financial traders move millions (and > sometimes billions) of Dollars, Euros, etc. through their spreadsheets > every day. A 5 or 10 second advantage in calculating a spreadsheet > could mean a significant profit for a trading firm. >=20 > So, I am comparing apples to apples. A Java program can be optimized > to perform as well as a C program for *certain* tasks. I/O bound tasks? Certain artificial benchmarks? Well yes, ruby can perform as well as C on those too, but that's hardly the point here. This thread's topic is not if a few Java programs can be made as fast as C. The point is, "write it in C" is a valid general advice, but "write it in Java" depends on a lot of factors noone of the Java crowd mentions beforehand, but wants to be taken into account afterwards when comparing performance. You can't have it both ways. ** Anyhow, I doubt the apples to apples and JIT argument. You can write self modifying C code to optimize at run time too. Now it is a bit far fetched to write a full JIT compiler in C just for your project. But, if there is opportunity for dynamic optimization at run time which the Java JIT compiler can take advantage of, there has to be an opportunity for run time optimization in C too. I don't say this is easy to spot or implement, just possible. After all, Java VMs are still written in C, aren't they? -J=FCrgen --=20 The box said it requires Windows 95 or better so I installed Linux --qMm9M+Fa2AknHoGS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iQEVAwUBRNiBBPy64gyiEfXtAQJHXgf/QyzR9q4zcklUsQ1zXPXZl8l6B5IqAH+y hqt3cOq+So3GUzwDUY0Y9H3uS09Uc1vmW26uJiriqOTQ8FiRLTpO/UsNnTY+22L1 5700RkJLDsFrn8vDa2W96MsMn/NpelNoWPU1FwVxbVEKNTB5AGRcRmtGNCQR9S6v bKDlF8EaJYcu2uQMgx+88cFMSoPcC1xpx/61SvwqoAm2lUpuLRgHzkrbwSLO09sq tSu1lYE7EVgsSiyOPrvv8ItnAeQ+jA6+Rq7LMiLaKSGxXb3xAjFGfKu56KEKLlUL FCPm7XxswjZSvU8DIcel3+gvB/c4y74BmenLh9tx0YO5wkVKjw8mNw== =yXKV -----END PGP SIGNATURE----- --qMm9M+Fa2AknHoGS--