[Mono-bugs] [Bug 418272] New: Scheduling time complexity of Sys.Threading.Timer is O(n)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Aug 19 07:43:16 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=418272


           Summary: Scheduling time complexity of Sys.Threading.Timer is
                    O(n)
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: juraj at hotfeet.ch
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The Timer class uses a hashtable (with both key and value pointing to the Timer
object) for keeping track of active timers. While the starting, changing and
disposing of timers are all O(1) operations, the scheduling method
SchedulerThread is of time complexity O(n) (n being the number of active
timers).

With System.Web using Sys.Threading.Timer for both session/cache expiration and
script timeouts, SchedulerThread might be responsible for a few occasional CPU
spikes on websites with lots of visitors.

Replacing the hashtable with a red-black tree could flatten those spikes. It
might make sense to adapt class/System/System.Collections.Generic/RBTree.cs.

http://en.wikipedia.org/wiki/Red-black_tree
http://www.ibm.com/developerworks/linux/library/l-cfs/?ca=dgr-lnxw04CFC4Linux


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list