Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8223E931D for ; Thu, 26 Jul 2012 13:34:18 +0000 (UTC) Received: (qmail 21426 invoked by uid 500); 26 Jul 2012 13:26:42 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 26291 invoked by uid 500); 26 Jul 2012 13:21:21 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 46203 invoked by uid 99); 26 Jul 2012 09:48:35 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2012 09:48:35 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 90A5F140B94 for ; Thu, 26 Jul 2012 09:48:35 +0000 (UTC) Date: Thu, 26 Jul 2012 09:48:35 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Message-ID: <2066262333.105408.1343296115598.JavaMail.jiratomcat@issues-vm> In-Reply-To: <535835686.90426.1343037694816.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Updated] (DERBY-5873) Avoid unnecessary allocation of Number instances in client/server MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-5873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-5873: -------------------------------------- Priority: Minor (was: Major) Issue & fix info: Patch Available > Avoid unnecessary allocation of Number instances in client/server > ----------------------------------------------------------------- > > Key: DERBY-5873 > URL: https://issues.apache.org/jira/browse/DERBY-5873 > Project: Derby > Issue Type: Improvement > Components: Network Client, Network Server > Affects Versions: 10.10.0.0 > Reporter: Knut Anders Hatlen > Assignee: Knut Anders Hatlen > Priority: Minor > Attachments: d5873-1a.diff, d5873-2a-bigdec.diff > > > Java 5 introduced some new static factory methods (called valueOf()) in the Number sub-classes, to be used in preference of the constructors unless a fresh instance is required. The valueOf() methods are allowed to cache and reuse objects, possibly reducing the allocation/gc cost and the memory footprint. For example, Integer.valueOf(int) uses a pre-allocated cache for values between -128 and +127 by default (the cache size can be tuned with JVM flags). > Now that the server and client code is compiled against Java 5 libraries, we should use the valueOf() methods to get those benefits. Note also that Java 5 auto-boxing of numbers uses these methods implicitly, so in many cases we can just remove the calls to the constructor and the compiler will automatically insert the calls for us. -- 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