Jesse Glick commented on Bug JENKINS-16301

As a baseline,

package hudson.model;
import hudson.Util;
import java.io.File;
public class Fingerprints {
    private static byte[] toByteArray(String md5sum) {
        byte[] data = "" class="code-keyword">new byte[16];
        for( int i=0; i<md5sum.length(); i+=2 )
            data[i/2] = (byte)Integer.parseInt(md5sum.substring(i,i+2),16);
        return data;
    }
    private static final byte[] SOME_MD5 = toByteArray(Util.getDigestOf("whatever"));
    public static void main(String[] args) throws Exception {
        Fingerprint f = new Fingerprint(new Fingerprint.BuildPtr("foo", 13), "stuff.jar", SOME_MD5);
        f.addWithoutSaving("some", 1);
        f.addWithoutSaving("some", 2);
        f.addWithoutSaving("some", 3);
        f.addWithoutSaving("some", 10);
        f.addWithoutSaving("other", 6);
        for (int i = 0; i < 100; i++) {
            for (int b = 0; b < 100; b += 2) {
                f.addWithoutSaving("job" + i, b);
            }
        }
        File x = new File("/tmp/fp.xml");
        int count = 10000;
        long start = System.currentTimeMillis();
        for (int i = 0; i < count; i++) {
            f.save(x);
        }
        long end = System.currentTimeMillis();
        System.out.println((1f * (end - start) / count) + "msec to save");
        start = System.currentTimeMillis();
        for (int i = 0; i < count; i++) {
            Fingerprint.load(x);
        }
        end = System.currentTimeMillis();
        System.out.println((1f * (end - start) / count) + "msec to load");
    }
}

reports:

1.8081msec to save
1.6956msec to load
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to