[jira] [Commented] (SANDBOX-401) [BeanUtils2] Performance improvement: store hash code of AccessibleObjectDescriptor as member variable

2012-03-05 Thread Benedikt Ritter (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/SANDBOX-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=1356#comment-1356
 ] 

Benedikt Ritter commented on SANDBOX-401:
-

Hm, I think the {{hashCode()}} implementation I proposed is not thread safe. 
I'm not sure if that is an issue, since {{AccessibleObjectDescriptor}} is 
created in line 86 to be used directly to retrieve an {{AccessibleObject}} via 
{{cache.get()}} in line 92. I think that it is not possible for two threads to 
access the same {{AccessibleObjectDescirptor}} at once, before the hash code 
has been computed the first time (but I'm not sure).
If it is an issue there are two ways to improve the patch:
# implement a private helper method {{computeHashCode()}} that computes the 
hash code and assigns it to the private hash code field in the constructor. 
This has the advantage, that the hashcode field can be final, making 
{{AccessbileObjectDescirptor}} immutable. However it will cause initialization 
to take longer.
# Compute the hash code into a local variable in {{hashCode()}} and assign it's 
value to the hashcode field, once computation is complete.

Please let me know, what you think.
Benedikt

 [BeanUtils2] Performance improvement: store hash code of 
 AccessibleObjectDescriptor as member variable
 --

 Key: SANDBOX-401
 URL: https://issues.apache.org/jira/browse/SANDBOX-401
 Project: Commons Sandbox
  Issue Type: Improvement
  Components: BeanUtils2
Affects Versions: Nightly Builds
Reporter: Benedikt Ritter
 Attachments: SANDBOX-401.txt


 As discussed on the ML, we should store the hash code of 
 AccessibleObjectDescriptor in a private member variable after it has been 
 computed the first time. The computed value can be returned on subsequent 
 invocations. Since AccessibleObjectDescriptor is immutable (all of its fields 
 are final) the hash code can never change, once an AccessibleObjectDescriptor 
 has been initialized.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (SANDBOX-401) [BeanUtils2] Performance improvement: store hash code of AccessibleObjectDescriptor as member variable

2012-03-05 Thread Simone Tripodi (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/SANDBOX-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=1366#comment-1366
 ] 

Simone Tripodi commented on SANDBOX-401:


Just saw the patch and indeed you can do it better ;) Don't get crazy with 
[Rube Goldber|http://www.rubegoldberg.com/?page=home]'s machines, just declare 
the {{private int hashCode}} as {{final}} and compute it just after all fields 
members are built. Why you do need {{computeHashCode()}}? Just to add another 
piece in the machine? ;)

{{AccessbileObjectDescirptor}} is already immutable - I don't mind if init 
takes longer - that op will be performed only once and acceding to that field 
will be always linear.

Looking forward next patch, TIA.

 [BeanUtils2] Performance improvement: store hash code of 
 AccessibleObjectDescriptor as member variable
 --

 Key: SANDBOX-401
 URL: https://issues.apache.org/jira/browse/SANDBOX-401
 Project: Commons Sandbox
  Issue Type: Improvement
  Components: BeanUtils2
Affects Versions: Nightly Builds
Reporter: Benedikt Ritter
 Attachments: SANDBOX-401.txt


 As discussed on the ML, we should store the hash code of 
 AccessibleObjectDescriptor in a private member variable after it has been 
 computed the first time. The computed value can be returned on subsequent 
 invocations. Since AccessibleObjectDescriptor is immutable (all of its fields 
 are final) the hash code can never change, once an AccessibleObjectDescriptor 
 has been initialized.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (SANDBOX-401) [BeanUtils2] Performance improvement: store hash code of AccessibleObjectDescriptor as member variable

2012-03-05 Thread Simone Tripodi (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/SANDBOX-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13222301#comment-13222301
 ] 

Simone Tripodi commented on SANDBOX-401:


I simply don't use wildcard imports and not sure how many of us use it - I 
suggest you not using it

 [BeanUtils2] Performance improvement: store hash code of 
 AccessibleObjectDescriptor as member variable
 --

 Key: SANDBOX-401
 URL: https://issues.apache.org/jira/browse/SANDBOX-401
 Project: Commons Sandbox
  Issue Type: Improvement
  Components: BeanUtils2
Affects Versions: Nightly Builds
Reporter: Benedikt Ritter
 Attachments: SANDBOX-401.txt, SANDBOX-401v2.txt


 As discussed on the ML, we should store the hash code of 
 AccessibleObjectDescriptor in a private member variable after it has been 
 computed the first time. The computed value can be returned on subsequent 
 invocations. Since AccessibleObjectDescriptor is immutable (all of its fields 
 are final) the hash code can never change, once an AccessibleObjectDescriptor 
 has been initialized.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (SANDBOX-401) [BeanUtils2] Performance improvement: store hash code of AccessibleObjectDescriptor as member variable

2012-03-05 Thread Benedikt Ritter (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/SANDBOX-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13222308#comment-13222308
 ] 

Benedikt Ritter commented on SANDBOX-401:
-

Okay, I've corrected my configuration. Can you correct the imports, when you 
apply the patch or do you want me to create a new one?

TIA!

 [BeanUtils2] Performance improvement: store hash code of 
 AccessibleObjectDescriptor as member variable
 --

 Key: SANDBOX-401
 URL: https://issues.apache.org/jira/browse/SANDBOX-401
 Project: Commons Sandbox
  Issue Type: Improvement
  Components: BeanUtils2
Affects Versions: Nightly Builds
Reporter: Benedikt Ritter
 Attachments: SANDBOX-401.txt, SANDBOX-401v2.txt


 As discussed on the ML, we should store the hash code of 
 AccessibleObjectDescriptor in a private member variable after it has been 
 computed the first time. The computed value can be returned on subsequent 
 invocations. Since AccessibleObjectDescriptor is immutable (all of its fields 
 are final) the hash code can never change, once an AccessibleObjectDescriptor 
 has been initialized.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira