J/Link speed of accessing arrays
- To: mathgroup at smc.vnet.net
- Subject: [mg29174] J/Link speed of accessing arrays
- From: ldwestbrook <ldwestbrook at gmx.net>
- Date: Fri, 1 Jun 2001 04:15:36 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I'm trying to use Mathematica as an interactive front end to for a set
of java objects using J/Link.
My question is this: what is the fastest way to access a given attribute
for each element in a large java array. For a 1000+ element array the
process is painfully slow using code like this on Windows NT:
myArray = myJavaClass@getArray[];
sum = 0;
Do[sum+=(myArray[[i]])@getAttribute[],{i,Length[myArray]}];
Print[sum]