[jboss-jira] [JBoss JIRA] (JGRP-1406) Replace System.currentTimeMillis() with System.nanoTime()

Bela Ban (JIRA) jira-events at lists.jboss.org
Fri Feb 10 08:25:48 EST 2012


    [ https://issues.jboss.org/browse/JGRP-1406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665622#comment-12665622 ] 

Bela Ban commented on JGRP-1406:
--------------------------------

Actually, TimeScheduler2 probably benefits from currentTimeMillis(): because of the lesser granularity, we have to create fewer entries in the tasks ConcurrentSkipListMap. This map is ordered in ascending order of its keys, which are execution times in milliseconds. If we had nanoseconds, we'd have many more keys, and that's bad as a ConcurrentSkipListMap has a high cost of inserting keys in sorted order !
With currentTimeMillis(), we have fewer keys (the same keys are then maintained in a list in the associated value, which is cheap).
                
> Replace System.currentTimeMillis() with System.nanoTime()
> ---------------------------------------------------------
>
>                 Key: JGRP-1406
>                 URL: https://issues.jboss.org/browse/JGRP-1406
>             Project: JGroups
>          Issue Type: Enhancement
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>            Priority: Minor
>             Fix For: 3.1
>
>
> For short timings, replace currentTimeMillis() with nanoTime(). This might get us better precision. Might need testing on Windows, where nanoTime() is apparently not implemented efficiently...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list