python Programming Glossary: timings
php's strtr for python http://stackoverflow.com/questions/10931150/phps-strtr-for-python strng i i 1 return ''.join buf Complete codes and timings https gist.github.com 2889181 python string share improve..
Is there any simple way to benchmark python script? http://stackoverflow.com/questions/1593019/is-there-any-simple-way-to-benchmark-python-script advantage of this approach is that it makes independent timings more comparable. This disadvantage is that GC may be an important..
more efficient way to calculate distance in numpy? http://stackoverflow.com/questions/17527340/more-efficient-way-to-calculate-distance-in-numpy EDIT I cannot run tests on such a large dataset but these timings are rather enlightening len_a len_b 10000 1000 a np.random.rand..
Why is numpy's einsum faster than numpy's built in functions? http://stackoverflow.com/questions/18365073/why-is-numpys-einsum-faster-than-numpys-built-in-functions compiled with gcc without mkl was also used to verify the timings. Please note the timings scale nearly linearly with system size.. mkl was also used to verify the timings. Please note the timings scale nearly linearly with system size and are not due to the.. and the fact that not everyone observes the same trends in timings. python arrays performance numpy multidimensional array share..
Base-2 (Binary) Representation Using Python http://stackoverflow.com/questions/187273/base-2-binary-representation-using-python below and tried out Python3's builtin bin function. All timings were for 100000 runs using an 01010101 bit pattern. Num Bits..
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers http://stackoverflow.com/questions/2119761/simple-python-challenge-fastest-bitwise-xor-on-data-buffers does not use up valuable cache lines. Timings As for the timings the slow_xor entry in the first edit referred to my improved.. refers to the code from the original questions. All timings are done for 1000 runs. slow_xor 1.85s 1x faster_slow_xor 1.25s..
Best way to strip punctuation from a string in Python http://stackoverflow.com/questions/265960/best-way-to-strip-punctuation-from-a-string-in-python regexes or string.translate as you can see from the below timings. For this type of problem doing it at as low a level as possible..
Efficiently finding the shortest path in large graphs http://stackoverflow.com/questions/3038661/efficiently-finding-the-shortest-path-in-large-graphs to the graph was rather expensive at ~1.5 minutes. These timings are consistent across multiple runs. I'd like to say that the..
Try/catch or validation for speed? http://stackoverflow.com/questions/5589532/try-catch-or-validation-for-speed EAFP or Easier to Ask Forgiveness than Permission . Those timings are Timing when the check succeeds with LBYL Timing when the..
Generating unique, ordered Pythagorean triplets http://stackoverflow.com/questions/575117/generating-unique-ordered-pythagorean-triplets that pattern. Below is a not very scientific set of timings using Java under Eclipse on my older laptop with other stuff..
numpy float: 10x slower than builtin in arithmetic operations? http://stackoverflow.com/questions/5956783/numpy-float-10x-slower-than-builtin-in-arithmetic-operations print s print 'Runtime ' datetime.now START_TIME The timings are float64 16.1s float32 16.1s float 3.2s Now both np floats.. anything I can do to fix it I want to emphasize that my timings are not due to any of the following the function calls the conversion.. print s print 'Runtime ' datetime.now START_TIME The timings are float64 34.56s float32 35.11s float 3.53s Just for the hell..
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters? http://stackoverflow.com/questions/638893/what-is-the-most-efficient-way-in-python-to-convert-a-string-to-all-lowercase-st than performing a linear search each time . Here are the timings I get for various of the solutions given import string re timeit..
Why is early return slower than else? http://stackoverflow.com/questions/8271139/why-is-early-return-slower-than-else in detail EDIT Seems not everybody is able to reproduce my timings so I thought it might be useful to give some info on my system...
Python: simple list merging based on intersections http://stackoverflow.com/questions/9110837/python-simple-list-merging-based-on-intersections timeit.timeit merge_alexis lsts setup setup number 3 These timings are obviously dependent on the specific parameters to the benchmark..
Prototyping with Python code before compiling http://stackoverflow.com/questions/16067/prototyping-with-python-code-before-compiling of your application in C you only rewrite the inner loop. Timings ctypes has the highest call overhead ~700ns followed by boost.python..
python function slowing down for no apparent reason http://stackoverflow.com/questions/1723494/python-function-slowing-down-for-no-apparent-reason x in range 38000 list2 x 1 x 2 for x in range 10000 160000 Timings not scientific but still #Original function real 2m16.780s user..
Longest equally-spaced subsequence http://stackoverflow.com/questions/18159911/longest-equally-spaced-subsequence input as random.randint 0 100000 for r in xrange 200000 . Timings. I tested with the following input data on my 32 bit system...
Why is numpy's einsum faster than numpy's built in functions? http://stackoverflow.com/questions/18365073/why-is-numpys-einsum-faster-than-numpys-built-in-functions Lets start with three arrays of dtype np.double . Timings are performed on a intel CPU using numpy 1.7.1 compiled with..
Fastest way to list all primes below N in python http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python primesfrom2to 15.9 primesfrom3to 18.4 ambi_sieve 29.3 Timings were measured using the command python mtimeit s import primes..
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers http://stackoverflow.com/questions/2119761/simple-python-challenge-fastest-bitwise-xor-on-data-buffers way the output array does not use up valuable cache lines. Timings As for the timings the slow_xor entry in the first edit referred..
OPENGL User Interface Programming http://stackoverflow.com/questions/78238/opengl-user-interface-programming
How can I optimize this Python code? http://stackoverflow.com/questions/788084/how-can-i-optimize-this-python-code was verse poets and the long input set was poets verse . Timings will obviously vary between different machines so if anyone..
|