[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-09-03 Thread JIRA

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

Dominique Jäggi commented on JCR-3870:
--

committed in r1700941 and r1700942

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
> Attachments: 
> 0001-JCR-3870-Export-SessionImpl-getItemOrNull-in-Jackrab.patch
>
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-08-11 Thread angela (JIRA)

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

angela commented on JCR-3870:
-

looks good to me

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
> Attachments: 
> 0001-JCR-3870-Export-SessionImpl-getItemOrNull-in-Jackrab.patch
>
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-08-06 Thread Thomas Mueller (JIRA)

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

Thomas Mueller commented on JCR-3870:
-

+1 Not only makes the code faster, but also reduces code size at the consumer 
side.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
> Attachments: 
> 0001-JCR-3870-Export-SessionImpl-getItemOrNull-in-Jackrab.patch
>
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-09 Thread Felix Meschberger (JIRA)

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

Felix Meschberger commented on JCR-3870:


This is actually not an edge case and has always been there.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-09 Thread Joel Richard (JIRA)

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

Joel Richard commented on JCR-3870:
---

This question made me thinking and I have checked it again. The ratio seems to 
vary a lot depending on the page. On most pages it's around 60% existing items, 
but there are exceptions. The optimisation will only apply to these 10-60%.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-08 Thread Carsten Ziegeler (JIRA)

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

Carsten Ziegeler commented on JCR-3870:
---

This shouldn't be too hard to repeat in Oak I think

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-08 Thread Felix Meschberger (JIRA)

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

Felix Meschberger commented on JCR-3870:


bq. there are many other places, where sling is optimized around how the JCR 
implementation behaves

Really ? Off the top of my head I know of the Oak Observer (falling back to 
regular JCR Observation is not available). Others ?

Indeed, at one point in early time, Sling had JCR Session pooling until 
Jackrabbit Repository.login became drammatically faster than pooled session 
cleanup. At which time we happily removed Session pooling from Sling.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-08 Thread Tobias Bocanegra (JIRA)

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

Tobias Bocanegra commented on JCR-3870:
---

so, this improvement would then only optimize for the other 10% ?

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-08 Thread Tobias Bocanegra (JIRA)

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

Tobias Bocanegra commented on JCR-3870:
---

sure...but if this results in 8% performance improvement there are many 
other places, where sling is optimized around how the JCR implementation 
behaves. In Jackrabbit 2.x the item-existance was cached, iirc, so the 
itemExits() -> getItem()  was fast.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-08 Thread Felix Meschberger (JIRA)

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

Felix Meschberger commented on JCR-3870:


I don't think it is worth exporting such a method.

The most basic problem is the JCR API requesting the getItem method to throw in 
case the item does not exist. So the itemExists method has been added to be 
able to check the existence (or visibility, actually) of the item before trying 
to access it.

So, the actual performance problem boils down to being an implementation 
problem: The API specification as [~mreutegg] pointed out suggest to check for 
existence before accessing the item and this is what Sling does. In other word 
Sling follows the API specification guidance.

As such Sling is expecting the implementation to do the best to support the API 
and the API guidance.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread Joel Richard (JIRA)

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

Joel Richard commented on JCR-3870:
---

Will be hard to change. ResourceResolver.getResource JavaDoc: {quote}For an 
implementation reading content from a Java Content Repository, the path could 
be a javax.jcr.Item path from which the resource object is loaded. In contrast 
to the resolve(String) method, this method does not apply any logic to the 
path, so the path is used as-is to fetch the content.{quote}

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread Joel Richard (JIRA)

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

Joel Richard commented on JCR-3870:
---

Actually it's the other way around: In around 90% of the calls the item does 
not exist. Just add a breakpoint in this method and log the following 
expression to the console to see yourself: {code}itemExists(jcrPath){code}

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread Tobias Bocanegra (JIRA)

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

Tobias Bocanegra commented on JCR-3870:
---

but this is an edge case, that should not be supported

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread Tobias Bocanegra (JIRA)

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

Tobias Bocanegra commented on JCR-3870:
---

If you anticipate the item to exist (which is probably 99% the case). I would 
rather proactively do a 'getItem()' and then catch the exception.


> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread Joel Richard (JIRA)

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

Joel Richard commented on JCR-3870:
---

The problem is that Sling allows to retrieve a property with the getResource 
method:{code}resolver.getResource("/content/jcr:primaryType").adaptTo(String.class);{code}
Therefore, you can only guess whether the resource is a node or a property.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/%3CD1495A09.3B670%25anchela%40adobe.com%3E



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread Marcel Reutegger (JIRA)

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

Marcel Reutegger commented on JCR-3870:
---

I would rather not make this method public. The specification requires an 
implementation to first check if a node exists at the given path and then check 
if there is a property. As written already in JavaDoc of {{Session.getItem()}}, 
you should not use this method if you already know the item is a node or a 
property and I assume Sling knows what kind of item it is looking for:

bq. This method should only be used if the application does not know whether 
the item at the indicated path is property or node. In cases where the 
application has this information, either getNode(java.lang.String) or 
getProperty(java.lang.String) should be used, as appropriate. In many 
repository implementations the node and property-specific methods are likely to 
be more efficient than getItem.

If really needed I would prefer to export getNodeOrNull() and 
getPropertyOrNull() variants.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/browser



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


[jira] [Commented] (JCR-3870) Export SessionImpl#getItemOrNull in JackrabbitSession

2015-04-07 Thread angela (JIRA)

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

angela commented on JCR-3870:
-

moving to Jackrabbit project; Component API. Once we have the API extension in 
the API we must implement it in the various implementations:

- jackrabbit-core
- jackrabbit-jcr2spi
- oak-jcr

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -
>
> Key: JCR-3870
> URL: https://issues.apache.org/jira/browse/JCR-3870
> Project: Jackrabbit Content Repository
>  Issue Type: Improvement
>  Components: jackrabbit-api
>Affects Versions: 2.10
>Reporter: Joel Richard
>Priority: Critical
>  Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/browser



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