Ticket #1276: trac_1276.patch

File trac_1276.patch, 2.2 kB (added by gfurnish, 8 months ago)

rebased & fixed devel repo patch for this.

  • /dev/null

    old new  
     1import sys 
     2from sage.misc.db import load 
     3 
     4if len(sys.argv) < 3: 
     5    print "Usage: compare_timings.py t1.sobj t2.sobj" 
     6    sys.exit(1) 
     7 
     8try: 
     9    timings1 = load(sys.argv[1]) 
     10    timings2 = load(sys.argv[2]) 
     11except AssertionError: 
     12    sys.exit(2) 
     13 
     14 
     15# fast enough? 
     16hashes = [ x for x in timings1.keys() if x in timings2.keys()] 
     17 
     18 
     19for h in hashes: 
     20    t1 = timings1[h] 
     21    t2 = timings2[h] 
     22    print h, t1.filename, "lines", t1.linenum, "and", t2.linenum, ":" 
     23    wall1 = t1.wallt 
     24    wall2 = t2.wallt 
     25    if wall1 < 0.00001: 
     26        if wall2 >= 0.00001: 
     27            print "+infty%% (%s)" % wall2 
     28    else: 
     29        p = (wall2-wall1)/wall1 
     30        print p 
     31 
  • /dev/null

    old new  
     1import sys 
     2from sage.misc.db import load 
     3 
     4if len(sys.argv) < 2: 
     5    print "Usage: show_timings.py t.sobj" 
     6    sys.exit(1) 
     7 
     8try: 
     9    timings = load(sys.argv[1]) 
     10except AssertionError: 
     11    sys.exit(2) 
     12 
     13for x in timings.keys(): 
     14    timings[x].show() 
     15 
  • /dev/null

    old new  
     1class DocTestTiming: 
     2    "Store timings for a docstring example" 
     3    def __init__(self, filename, linenum, examplename, hash, cput, wallt): 
     4        self.filename = filename 
     5        self.linenum = linenum 
     6        self.examplename = examplename 
     7        self.hash = hash 
     8        self.cput = cput 
     9        self.wallt = wallt 
     10    def show(self): 
     11        print "%s, %s, line %s, hash %s: cpu %s, wall %s" % ( self.examplename, self.filename, self.linenum, self.hash, self.cput, self.wallt ) 
     12