[CalendarServer-changes] [6163] CalendarServer/trunk/contrib/performance/compare.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 20 14:05:16 PDT 2010


Revision: 6163
          http://trac.macosforge.org/projects/calendarserver/changeset/6163
Author:   exarkun at twistedmatrix.com
Date:     2010-08-20 14:05:16 -0700 (Fri, 20 Aug 2010)
Log Message:
-----------
use a 10% trimmed mean to improve t-test robustness, with obviously beneficial results

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/compare.py

Modified: CalendarServer/trunk/contrib/performance/compare.py
===================================================================
--- CalendarServer/trunk/contrib/performance/compare.py	2010-08-20 21:04:44 UTC (rev 6162)
+++ CalendarServer/trunk/contrib/performance/compare.py	2010-08-20 21:05:16 UTC (rev 6163)
@@ -22,9 +22,26 @@
             [p, None])
 
 
+def trim(sequence, amount):
+    sequence.sort()
+    n = len(sequence)
+    t = int(n * amount / 2.0)
+    if t:
+        del sequence[:t]
+        del sequence[-t:]
+    else:
+        raise RuntimeError(
+            "Cannot trim length %d sequence by %d%%" % (n, int(amount * 100)))
+    return sequence
+
+
 def main():
     [(stat, first), (stat, second)] = load_stats(sys.argv[1:])
 
+    # Attempt to increase robustness by dropping the outlying 10% of values.
+    first = trim(first, 0.1)
+    second = trim(second, 0.1)
+
     fmean = stats.mean(first)
     smean = stats.mean(second)
     p = 1 - ttest_1samp(second, fmean)[1][0]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100820/187b2a6a/attachment.html>


More information about the calendarserver-changes mailing list