PyStone

A nifty way to benchmark a machine using Python (and it’s built in)

MacAir:~ raf$ python3 /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/test/pystone.py
Pystone(1.2) time for 50000 passes = 0.614033
This machine benchmarks at 81428.9 pystones/second
MacAir:~ raf$

And my Mac Pro:

FLD-ML-00020763:GIT kruczkowski$ python3 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/test/pystone.py
Pystone(1.2) time for 50000 passes = 0.39734
This machine benchmarks at 125837 pystones/second
FLD-ML-00020763:GIT kruczkowski$

And my new Thinkpad:

raf@thinkpad:~$ /usr/lib/python3.5/test/pystone.py
Pystone(1.2) time for 50000 passes = 0.216861
This machine benchmarks at 230562 pystones/second

Back to Python

Reviewing Python studies after a break on doing other things such as moves, work projects and life.  Here’s some of my notes from the past reviews and notebooks.

Data Objects

object.attribute
function(argument)
object.method(argument)
list = ['a', 'b', 'c']
dictionary = {'key':'value','key':'value'}
tuple = ('bob',40)
for target in object:
    statement
else:
    statement

Files

f = open ('foo.txt', 'rU')
for line in f:
    print(line),
f.close()

Classes

def myclass(mylocallist):
   print(mylocallist)

myclass(mylist)