harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksey Shipilev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5907) [classlib][pack200]CPUTF8.hashCode() is slow
Date Mon, 14 Jul 2008 18:30:31 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-5907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12613401#action_12613401
] 

Aleksey Shipilev commented on HARMONY-5907:
-------------------------------------------

Yep, Andrew, you're right about generateHashCode() contract. It should be 

private void generateHashCode() {
    if (hashCodeComputed) return;
    cachedHashCode = { .... };
    hashCodeComputed = true;
}

public int hashCode() {
    generateHashCode();
    return cachedHashCode;
}

Can you take the honor of updating the patch?

> [classlib][pack200]CPUTF8.hashCode() is slow
> --------------------------------------------
>
>                 Key: HARMONY-5907
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5907
>             Project: Harmony
>          Issue Type: Improvement
>    Affects Versions: 5.0M6
>         Environment: Latest pack200
>            Reporter: Andrew Cornwall
>            Assignee: Sian January
>         Attachments: main.patch, pack200-hashcodes-v1.patch
>
>
> The unpack process spends a lot of time doing CPUTF8.hashCode() - which does String.hashCode().
We can save about 1.5 seconds of my 39 second test case (about 4%) by caching the hashCode.
(I thought we did this before - or maybe I dreamt it?)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message