1. Lava

I just tried a benchmark from the latest Linux Journal. Code is at the end of
this message.  The original benchmark called for the creation of 500,000
integers, then summing them. Java runs out of memory at just over 400,000
on my pc (32 megs). Here are the results, with the sights lowered a bit:

Java, 400000 integer objects,
ET 6922 millisec. or 58 per millisecond.*
(*timings reasonably close to LJ results)

Euphoria, 400000 integers,
ET 339 millisec, or 1176 per millisecond.

Euphoria can do Java's 400k, plus another 4 million, in slightly less time
than it takes Java do the 400k.  Euphoria's virtual memory kicks  in arount
5,000,000 and things slow down considerably, but the job eventually gets
done.

If we consider a "toy" language as one which can't do real work, then Java
certainly qualifies.

Regards,
Irv

public class PerformanceTester
{
  private int amount;
  private static int NOBJECTS = 400000;

 public void addAmount (int val)
 {
  amount += val;
 }

 public int getAmount ()
 {
 return amount;
 }

public static void main (String[] args)
{
 long starttime = 0;
 long endtime = 0;
 int sum = 0;

 starttime = System.currentTimeMillis();

 PerformanceTester[] ptarr = new PerformanceTester[NOBJECTS];

 for (int i = 0; i < NOBJECTS; i++)
     ptarr[i] = new PerformanceTester();

 for (int i = 0; i < NOBJECTS; i++)
     ptarr[i].addAmount(i);

 for (int i = 0; i < NOBJECTS; i++)
     sum += ptarr[i].getAmount();

 endtime = System.currentTimeMillis();

System.out.println ("Elapsed time in milliseconds for "
+ NOBJECTS + " objects: " + (endtime - starttime));
System.out.println("Objects per millisecond: "
+ (NOBJECTS / (endtime-starttime)));
 }
}

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu