Compare commits
	
		
			2 Commits
		
	
	
		
			master
			...
			nilmdb-ori
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e201f67684 | |||
| 44fce1ff33 | 
@@ -91,7 +91,8 @@ def test_intervalset_construct():
 | 
				
			|||||||
    assert(iseta == isetc)
 | 
					    assert(iseta == isetc)
 | 
				
			||||||
    assert(iseta != 3)
 | 
					    assert(iseta != 3)
 | 
				
			||||||
    assert(IntervalSet(a) != IntervalSet(b))
 | 
					    assert(IntervalSet(a) != IntervalSet(b))
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
 | 
					    print iseta == None
 | 
				
			||||||
    assert_raises(TypeError, cmp, iseta, isetb)
 | 
					    assert_raises(TypeError, cmp, iseta, isetb)
 | 
				
			||||||
    assert_raises(IntervalError, IntervalSet, [a, b, c])
 | 
					    assert_raises(IntervalError, IntervalSet, [a, b, c])
 | 
				
			||||||
    assert_raises(TypeError, IntervalSet, [1, 2])
 | 
					    assert_raises(TypeError, IntervalSet, [1, 2])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
all:
 | 
					all:
 | 
				
			||||||
	python speed-readbinary.py
 | 
						python speed-readascii.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -f *pyc
 | 
						rm -f *pyc
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,17 +43,24 @@ def test_bigregex():
 | 
				
			|||||||
        if (n % 100000 == 0):
 | 
					        if (n % 100000 == 0):
 | 
				
			||||||
            printf("line %d = %s\n", n, str(out))
 | 
					            printf("line %d = %s\n", n, str(out))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_numpy():
 | 
				
			||||||
 | 
					    out = np.genfromtxt(open('1m.raw', 'r'),
 | 
				
			||||||
 | 
					                        dtype = np.dtype('i2,i2,i2,i2,i2,i2'))
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					with Timer("numpy"):
 | 
				
			||||||
 | 
					    test_numpy() # 106k/sec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
with Timer("regex"):
 | 
					with Timer("regex"):
 | 
				
			||||||
    test_regex() # 102k/sec
 | 
					    test_regex() # 121k/sec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
with Timer("split"):
 | 
					with Timer("split"):
 | 
				
			||||||
    test_split() # 175k/sec
 | 
					    test_split() # 219k/sec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
with Timer("split2"):
 | 
					with Timer("split2"):
 | 
				
			||||||
    test_split2() # 275k/sec
 | 
					    test_split2() # 328k/sec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
with Timer("bigregex"):
 | 
					with Timer("bigregex"):
 | 
				
			||||||
    test_bigregex() # 110k/sec
 | 
					    test_bigregex() # 130k/sec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The "int" operation takes quite a while -- int(x,10) is twice as fast
 | 
					# The "int" operation takes quite a while -- int(x,10) is twice as fast
 | 
				
			||||||
# Perl does about 500k/sec
 | 
					# Perl does about 500k/sec
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user