You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Jim Yu (JIRA)" <ji...@apache.org> on 2008/05/30 11:19:45 UTC
[jira] Updated: (HARMONY-5853) [classlib][util] Performance
improvement in Timer
[ https://issues.apache.org/jira/browse/HARMONY-5853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jim Yu updated HARMONY-5853:
----------------------------
Attachment: HARMONY-5853.diff
> [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
> 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.