[
https://issues.apache.org/jira/browse/SOLR-390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537062
]
Yonik Seeley commented on SOLR-390:
-----------------------------------
As I suspected, it doesn't look like there is yet any JVM acceleration for
Arrays.fill() (and I wouldn't hold my breath).
I just tested with Java 1.6 -server, and my current method appears about 88%
faster (on a P4 at least).
I used an array size of 1000 (since HashDocSet will normally be between 1 and
3000),
and 10,000,000 iterations.
explicit loop countdown => 9281 msec
Arrays.fill => 17515 msec
{code}
public class TestPerf {
private static int VAL=-1;
private static void fill(int[] x) {
/*
for (int i=x.length-1; i>=0; i--) {
x[i] = VAL;
}
*/
Arrays.fill(x,VAL);
}
public static void main(String[] args) {
int a=0;
int sz = Integer.parseInt(args[a++]);
int iter = Integer.parseInt(args[a++]);
int[] x = new int[sz];
int ret=0;
long start = System.currentTimeMillis();
for (int i=0; i<iter; i++) {
fill(x);
ret = ret + x[0]; // use results
}
long end = System.currentTimeMillis();
System.out.println("result=" + ret);
System.out.println("time=" +(end-start));
}
}
{code}
> HashDocSet initialization of internal array is not efficient
> ------------------------------------------------------------
>
> Key: SOLR-390
> URL: https://issues.apache.org/jira/browse/SOLR-390
> Project: Solr
> Issue Type: Bug
> Components: search
> Reporter: John Wang
>
> HashDocSet initializes the internal array but iterating it instead of using
> Arrays.fill which is much faster. Patch included
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.