You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2015/09/23 17:01:04 UTC

[jira] [Commented] (OAK-3440) MemoryNodeBuilder creates superfluous instances of ConnectedHead

    [ https://issues.apache.org/jira/browse/OAK-3440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14904609#comment-14904609 ] 

Michael Dürig commented on OAK-3440:
------------------------------------

I think functionally the patch is fine. However I find the code clearer and cleaner without the patch as
* incrementing {{rootHead.revision}} is encapsulated in {{ConnectedHead}}.
* The code in {{UnconnectedHead.getMutableNodeState()}} somewhat resembles that in {{UnconnectedHead.update()}}.

As {{MemoryNodeBuilder}} is a complex beast that took several refactorings to get it right and balance readability and performance, I'd prefer to leave it as is unless we have a convincing reason otherwise. AFAIC modern JVMs are quite good at handling 'throw away' instance. In this case it will probably even get 'hotspotted away'.

> MemoryNodeBuilder creates superfluous instances of ConnectedHead
> ----------------------------------------------------------------
>
>                 Key: OAK-3440
>                 URL: https://issues.apache.org/jira/browse/OAK-3440
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Francesco Mari
>            Priority: Minor
>         Attachments: OAK-3440-01.patch
>
>
> MemoryNodeBuilder creates a throw-away instance of ConnectedHead when a MutableNodeState is requested to an UnconnectedHead. The throw-away ConnectedHead could be spared by simplifying UnconnectedHead.getMutableNodeState().



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)