Return-Path: Delivered-To: apmail-lucene-hadoop-dev-archive@locus.apache.org Received: (qmail 81473 invoked from network); 16 Feb 2007 19:15:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Feb 2007 19:15:35 -0000 Received: (qmail 47272 invoked by uid 500); 16 Feb 2007 19:15:34 -0000 Delivered-To: apmail-lucene-hadoop-dev-archive@lucene.apache.org Received: (qmail 47226 invoked by uid 500); 16 Feb 2007 19:15:34 -0000 Mailing-List: contact hadoop-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hadoop-dev@lucene.apache.org Delivered-To: mailing list hadoop-dev@lucene.apache.org Received: (qmail 47202 invoked by uid 99); 16 Feb 2007 19:15:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Feb 2007 11:15:34 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Feb 2007 11:15:25 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CE3E97141E5 for ; Fri, 16 Feb 2007 11:15:05 -0800 (PST) Message-ID: <6313667.1171653305842.JavaMail.jira@brutus> Date: Fri, 16 Feb 2007 11:15:05 -0800 (PST) From: "Owen O'Malley (JIRA)" To: hadoop-dev@lucene.apache.org Subject: [jira] Commented: (HADOOP-1017) Optimization: Reduce Overhead from ReflectionUtils.newInstance In-Reply-To: <8341615.1171393805599.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473793 ] Owen O'Malley commented on HADOOP-1017: --------------------------------------- I'd vote for the synchronized map. The failure mode would just be that you look up the constructor a second time. > 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: cacheCtor.patch, 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.