You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Doug Cutting (JIRA)" <ji...@apache.org> on 2007/02/13 23:18:06 UTC

[jira] Commented: (HADOOP-1017) Optimization: Reduce Overhead from ReflectionUtils.newInstance

    [ https://issues.apache.org/jira/browse/HADOOP-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472895 ] 

Doug Cutting commented on HADOOP-1017:
--------------------------------------

Overall, I like this.  In most cases, where classes are not GC'd, the use of a WeakHashMap is moot, but it shouldn't hurt and may help in some cases.  But I'd prefer we don't expose the cache through a public API, nor permit disabling it through a system property.  A larger public API complicates long-term support.  If the cache size ever becomes an issue then we can address that then.

> Optimization: Reduce Overhead from ReflectionUtils.newInstance
> --------------------------------------------------------------
>
>                 Key: HADOOP-1017
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1017
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: util
>            Reporter: Ron Bodkin
>         Attachments: ReflectionUtils.patch.txt, TestReflectionUtils.java
>
>
> I found that a significant amount of time on my project was being spent in creating constructors for each row of data. I dramatically optimized this performance by creating a simple WeakHashMap to cache constructors by class. For example, in a sample job I find that ReflectionUtils.newInstance takes 200 ms (2% of total) with the cache enabled, but it uses 900 ms (6% of total) without the cache.

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