The three most important things seem to be:
1) Run java in -server mode. This appears to double speed for no effort.
2) As you say, avoid creating objects. For example, instead of
creating a new array each time a method is invoked, make the array a
field and just clear it out when you need a "new" one. Similarly,
instead of
Foo x = y.clone();
do something like
x.copyDataFrom(y);
where of course you have to write copyDataFrom().
3) Algorithmic improvements are always more important that fine-tuning.
Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/
On Dec 4, 2006, at 2:40 AM, Eduardo Sabbatella wrote:
Would you like to share some experiences on tunning up
Java code ?
Yesterday I left my machine profilling the code.
(takes ages with TPTP).
I didn't research too much the results, but as far I
could see, creating objects is almost FORBIDDEN.
The "clone" method on game class which is used for
create a copy of game object for every simulation is
the function that is taking the most of the time.
(implies a couple of inner clones...)
Also, a "getNear" method that returns a list of near
points (considering borders) is the second most
expensive. (even, being optimised ... The problem is
that is creating a new array of size 1|2|3|4 elements
for returning the result).
About game class, I think that I will change to simple
floodfill insteads of maintaining a list of liberties
and chains. Clonning that list is expensive.
--- Peter Drake <[EMAIL PROTECTED]> escribió:
A note: we're working on converting Orego back from
C++ to Java, and
we're getting 5,000 (totally random at this point)
simulated games
per second. We'll probably continue in this
direction.
Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/