[Beowulf] C vs C++ challenge (java version)

Didier Carlier dc at hemeris.com
Fri Jan 30 04:31:45 EST 2004

On Jan 29, 2004, at 23:56, Robert G. Brown wrote:

> On Thu, 29 Jan 2004, Joe Landman wrote:
>> On Thu, 2004-01-29 at 09:55, dc wrote:
>>> file            size        C++         j client    j server
>>> wrnpc10.txt     3282452     0m2.746s    0m1.941s    0m1.643s
>>> shaks12.txt     5582655     0m4.476s    0m3.321s    0m2.842s
>>> big.txt         39389424    0m29.120s   0m13.972s   0m12.776s
>>> vbig.txt        196947120   2m23.882s   1m5.707s    1m2.350s
>> Where did these files come from?  Would be nice to try out
>> non-C++/non-Java solutions with.
> At least shaks12.txt is from project gutenberg and shows up as a direct
> link to there, first thing, from Google on a "shaks12 txt" search.  I
> haven't tried the rest of them -- if a tool works for Shakespeare it
> SHOULD work for any of the rest.  The only dicey point will arise when
> the filesize starts to compete with available free memory [...]

Exactly. The rnpc10.txt is "War and Peace" (also from Gutenberg), 
big.txt is simply 12 copies of wrnp10.txt concatenated, and vbig,txt is 
60 copies of wrnp10.txt concatenated.

I included the 2 large files because Java makes little sense for 
run-times of a couple of seconds where more time is spent compiling the 
code than executing it. Also  I didn't think that run-times of 1 or 2 
seconds were of particular interest on this list.

Looking at the (elapsed time)/(file size) ratio for the 2 big files, 
both the C++ and the Java elapsed times seem to scale linearly with the 
file size, but (* in this particular test *) java beats c++ by a factor 
of 2.3 for large files and only 1.6 for the smaller one.


Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf

More information about the Beowulf mailing list