Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 69807 invoked from network); 24 Jun 2009 08:55:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jun 2009 08:55:18 -0000 Received: (qmail 19983 invoked by uid 500); 24 Jun 2009 08:55:29 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 19955 invoked by uid 500); 24 Jun 2009 08:55:29 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 19946 invoked by uid 99); 24 Jun 2009 08:55:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2009 08:55:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2009 08:55:27 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7CAB5234C055 for ; Wed, 24 Jun 2009 01:55:07 -0700 (PDT) Message-ID: <345968680.1245833707509.JavaMail.jira@brutus> Date: Wed, 24 Jun 2009 01:55:07 -0700 (PDT) From: "Jim Yu (JIRA)" To: commits@harmony.apache.org Subject: [jira] Closed: (HARMONY-5853) [classlib][util] Performance improvement in Timer In-Reply-To: <1542176646.1212139185021.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-5853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jim Yu closed HARMONY-5853. --------------------------- > [classlib][util] Performance improvement in Timer > ------------------------------------------------- > > Key: HARMONY-5853 > URL: https://issues.apache.org/jira/browse/HARMONY-5853 > Project: Harmony > Issue Type: Improvement > Components: Classlib > Affects Versions: 5.0M6 > Reporter: Jim Yu > Assignee: Sean Qiu > Fix For: 5.0M7 > > Attachments: HARMONY-5853.diff > > > An performance improvement in Timer by using Binary-Heap intead of Binary Search Tree to manage tasks. > The main reason is that the inner class TimerImpl of Timer will launch a separate thread for each Timer. In this thread, > it will frequently call task = tasks.minimum(), which selects a task with the minimum 'when' field value from the > task manager. At present, the task manager's data structure is a Binary Search Tree. It needs to search the tree > from the root to get the node with the minimum value. The time complexity in worst case is the height of the tree. > If we use a Binary-Heap instead to manage the tasks, the node with minimum value is always the root. The time > complexity is O(1). Moreover, the performance of Binary-Heap for node insert and remove operation is also very > fast. Though Binary Search Tree has the advantage of searching a specific node, the search operation is happened > very seldom in the thread. Therefore, Binary-Heap excels Binary Search Tree in the total performace of task management. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.