On Tue, 2004-11-16 at 05:36, Majorinc, Kazimir wrote:
...
>
> These days issue becomes critical for me. I'm sending similar program for a
> test again. The program constructs dynamic structures resembling "real
> ones" closely. I need help of someone who is willing to execute it on some
> Linux Unicon (until it crashes or start "thrashing") and send the program
> output publicly or privately. Also, if someone uses other Windows or Linux
> programming tools (Jcon, Python, Lisp, Ruby, Wrapl, anything) regularly,
> and is willing to translate and test the program and send information, it
> will help me to make informed decision.
Just for grins, I cobbled together a quick and dirty translation into
Java (the code can be made more efficient, but...). I've attached that
version and a sample run (I didn't adjust the max heap size of the JVM,
so this ran out of memory pretty quickly). Interestingly, the Unicon
version is faster [though I would expect a more carefully written Java
version would reverse that result]!
This version only uses a 'list' (vector), and doesn't try to support
a set solution as well...
Same machine: Dual CPU Athlon 2600+, 1GB RAM, Red Hat Linux 9.0, Sun
JDK 1.5.0
--
Steve Wampler <[EMAIL PROTECTED]>
import java.util.*;
public class Crash {
public static void main(String args[]) {
Vector nodes = new Vector();
long edges = 0;
System.out.println("Nodes, edges, seconds");
long tms = (new Date()).getTime();
while (true) {
Vector new_node = new Vector();
for (int i = 0; i < numIters(nodes); ++i) {
Vector old_node = randomElement(nodes);
new_node.add(old_node);
old_node.add(new_node);
edges += 1;
}
nodes.add(new_node);
if (nodes.size() % 500 == 0) {
System.out.println(""+nodes.size()+", "+edges+", "+
(((new Date()).getTime())-tms)/1000.0);
}
}
}
private static long numIters(Vector nodes) {
return 2*Math.round(Math.sqrt((double)nodes.size()));
}
private static Vector randomElement(Vector nodes) {
return (Vector)nodes.elementAt(rand.nextInt(nodes.size()));
}
private static Random rand = new Random();
}
Script started on Tue Nov 16 09:17:41 2004
tapestry% java Crash
Nodes, edges, seconds
500, 14872, 0.03
1000, 42112, 0.054
1500, 77402, 0.092
2000, 119190, 0.17
2500, 166600, 0.262
3000, 219010, 0.317
3500, 276002, 0.449
4000, 337218, 0.532
4500, 402402, 0.696
5000, 471298, 0.795
5500, 543752, 1.015
6000, 619542, 1.118
6500, 698598, 1.251
7000, 780752, 1.344
7500, 865882, 1.591
8000, 953902, 1.724
8500, 1044752, 1.838
9000, 1138290, 1.987
9500, 1234422, 2.113
10000, 1333200, 2.274
10500, 1434392, 2.645
11000, 1538110, 2.792
11500, 1644162, 2.972
12000, 1752520, 3.172
12500, 1863232, 3.334
13000, 1976152, 3.845
13500, 2091248, 4.015
14000, 2208488, 4.197
14500, 2327840, 4.387
15000, 2449272, 4.584
15500, 2572752, 4.783
16000, 2698248, 4.992
16500, 2825728, 5.783
17000, 2955160, 5.935
17500, 3086512, 6.157
18000, 3219752, 6.398
18500, 3354848, 6.651
19000, 3491768, 6.899
19500, 3630480, 7.157
20000, 3770998, 7.422
20500, 3913338, 7.602
21000, 4057390, 7.873
21500, 4203122, 9.095
22000, 4350608, 9.358
22500, 4499800, 9.636
23000, 4650592, 11.026
23500, 4803078, 12.714
24000, 4957210, 14.183
24500, 5112862, 15.743
25000, 5270248, 19.043
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
tapestry%
Script done on Tue Nov 16 09:18:55 2004