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: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to