You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2008/05/15 17:13:55 UTC
[jira] Created: (JCR-1604) NameImpl improvements
NameImpl improvements
---------------------
Key: JCR-1604
URL: https://issues.apache.org/jira/browse/JCR-1604
Project: Jackrabbit
Issue Type: Improvement
Components: jackrabbit-jcr-commons
Reporter: Jukka Zitting
Priority: Minor
I'd like to propose the following changes to NameImpl in jackrabbit-jcr-commons:
1) Don't intern the namespace string. Most often the namespace string is in any case coming from a namespace registry, so there aren't that many copies of the same strings lying around. Also, I don't think the performance impact on NameImpl.equals() is significant even if there are multiple copies of the same namespace string.
2) Don't memorize the hash code. Since String already memorizes its hash code, the cost of NameImpl.hashCode() is just a few bytecode instructions. I don't think the performance benefit is worth the extra complexity and memory overhead.
3) Don't memoize the string representation. NameImpl.toString() method is typically only invoked when debugging or when serializing name values. In both cases the CPU overhead of recreating the string is insignificant and IMHO not worth the memory overhead .
I'll attach the patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1604) NameImpl improvements
Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597401#action_12597401 ]
Stefan Guggisberg commented on JCR-1604:
----------------------------------------
1) and 2) were introduced quite a while ago after some extensive profiling/performance testing. equals() and hashCode() turned out to consume a lot of CPU time (since names, as part of property id's, are used as hashmap keys) and the said carefully chosen modifications helped improve overall performance significantly.
unless there's some real issue with those i'd prefer to not apply the proposed hanges, i.e. keep NameImpl as is.
> NameImpl improvements
> ---------------------
>
> Key: JCR-1604
> URL: https://issues.apache.org/jira/browse/JCR-1604
> Project: Jackrabbit
> Issue Type: Improvement
> Components: jackrabbit-jcr-commons
> Reporter: Jukka Zitting
> Priority: Minor
> Attachments: NameImpl.patch
>
>
> I'd like to propose the following changes to NameImpl in jackrabbit-jcr-commons:
> 1) Don't intern the namespace string. Most often the namespace string is in any case coming from a namespace registry, so there aren't that many copies of the same strings lying around. Also, I don't think the performance impact on NameImpl.equals() is significant even if there are multiple copies of the same namespace string.
> 2) Don't memorize the hash code. Since String already memorizes its hash code, the cost of NameImpl.hashCode() is just a few bytecode instructions. I don't think the performance benefit is worth the extra complexity and memory overhead.
> 3) Don't memoize the string representation. NameImpl.toString() method is typically only invoked when debugging or when serializing name values. In both cases the CPU overhead of recreating the string is insignificant and IMHO not worth the memory overhead .
> I'll attach the patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1604) NameImpl improvements
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-1604:
-------------------------------
Attachment: NameImpl.patch
Proposed patch.
> NameImpl improvements
> ---------------------
>
> Key: JCR-1604
> URL: https://issues.apache.org/jira/browse/JCR-1604
> Project: Jackrabbit
> Issue Type: Improvement
> Components: jackrabbit-jcr-commons
> Reporter: Jukka Zitting
> Priority: Minor
> Attachments: NameImpl.patch
>
>
> I'd like to propose the following changes to NameImpl in jackrabbit-jcr-commons:
> 1) Don't intern the namespace string. Most often the namespace string is in any case coming from a namespace registry, so there aren't that many copies of the same strings lying around. Also, I don't think the performance impact on NameImpl.equals() is significant even if there are multiple copies of the same namespace string.
> 2) Don't memorize the hash code. Since String already memorizes its hash code, the cost of NameImpl.hashCode() is just a few bytecode instructions. I don't think the performance benefit is worth the extra complexity and memory overhead.
> 3) Don't memoize the string representation. NameImpl.toString() method is typically only invoked when debugging or when serializing name values. In both cases the CPU overhead of recreating the string is insignificant and IMHO not worth the memory overhead .
> I'll attach the patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1604) NameImpl improvements
Posted by "angela (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
angela updated JCR-1604:
------------------------
Component/s: (was: jackrabbit-jcr-commons)
jackrabbit-spi-commons
changing component to jackrabbit-spi-commons
> NameImpl improvements
> ---------------------
>
> Key: JCR-1604
> URL: https://issues.apache.org/jira/browse/JCR-1604
> Project: Jackrabbit
> Issue Type: Improvement
> Components: jackrabbit-spi-commons
> Reporter: Jukka Zitting
> Priority: Minor
> Attachments: NameImpl.patch
>
>
> I'd like to propose the following changes to NameImpl in jackrabbit-jcr-commons:
> 1) Don't intern the namespace string. Most often the namespace string is in any case coming from a namespace registry, so there aren't that many copies of the same strings lying around. Also, I don't think the performance impact on NameImpl.equals() is significant even if there are multiple copies of the same namespace string.
> 2) Don't memorize the hash code. Since String already memorizes its hash code, the cost of NameImpl.hashCode() is just a few bytecode instructions. I don't think the performance benefit is worth the extra complexity and memory overhead.
> 3) Don't memoize the string representation. NameImpl.toString() method is typically only invoked when debugging or when serializing name values. In both cases the CPU overhead of recreating the string is insignificant and IMHO not worth the memory overhead .
> I'll attach the patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JCR-1604) NameImpl improvements
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting resolved JCR-1604.
--------------------------------
Resolution: Won't Fix
Assignee: Jukka Zitting
Resolving as Won't Fix based on objections above and the fact that since JCR-1663 the number of NameImpl instances is already dramatically reduced, making the size of individual instances much less of an issue.
> NameImpl improvements
> ---------------------
>
> Key: JCR-1604
> URL: https://issues.apache.org/jira/browse/JCR-1604
> Project: Jackrabbit
> Issue Type: Improvement
> Components: jackrabbit-spi-commons
> Reporter: Jukka Zitting
> Assignee: Jukka Zitting
> Priority: Minor
> Attachments: NameImpl.patch
>
>
> I'd like to propose the following changes to NameImpl in jackrabbit-jcr-commons:
> 1) Don't intern the namespace string. Most often the namespace string is in any case coming from a namespace registry, so there aren't that many copies of the same strings lying around. Also, I don't think the performance impact on NameImpl.equals() is significant even if there are multiple copies of the same namespace string.
> 2) Don't memorize the hash code. Since String already memorizes its hash code, the cost of NameImpl.hashCode() is just a few bytecode instructions. I don't think the performance benefit is worth the extra complexity and memory overhead.
> 3) Don't memoize the string representation. NameImpl.toString() method is typically only invoked when debugging or when serializing name values. In both cases the CPU overhead of recreating the string is insignificant and IMHO not worth the memory overhead .
> I'll attach the patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1604) NameImpl improvements
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597392#action_12597392 ]
Jukka Zitting commented on JCR-1604:
------------------------------------
I chatted with Stefan about this, and he mentioned at least the interning of namespace strings being based on solid benchmarks, so we should keep it.
The other things might also be worth keeping, especially if we put some effort in reducing the number of separate Name instances kept around.
The background for this proposal is that I've been looking at ways of reducing the memory impact of large transient spaces (or large item caches), and reducing the size of NameImpl would contribute a bit (~1%).
> NameImpl improvements
> ---------------------
>
> Key: JCR-1604
> URL: https://issues.apache.org/jira/browse/JCR-1604
> Project: Jackrabbit
> Issue Type: Improvement
> Components: jackrabbit-jcr-commons
> Reporter: Jukka Zitting
> Priority: Minor
> Attachments: NameImpl.patch
>
>
> I'd like to propose the following changes to NameImpl in jackrabbit-jcr-commons:
> 1) Don't intern the namespace string. Most often the namespace string is in any case coming from a namespace registry, so there aren't that many copies of the same strings lying around. Also, I don't think the performance impact on NameImpl.equals() is significant even if there are multiple copies of the same namespace string.
> 2) Don't memorize the hash code. Since String already memorizes its hash code, the cost of NameImpl.hashCode() is just a few bytecode instructions. I don't think the performance benefit is worth the extra complexity and memory overhead.
> 3) Don't memoize the string representation. NameImpl.toString() method is typically only invoked when debugging or when serializing name values. In both cases the CPU overhead of recreating the string is insignificant and IMHO not worth the memory overhead .
> I'll attach the patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.