Nice interactive python shell.
Benchmarking runtime can be done just like in bash, by prefixing a command with%time
%time (numpy.array(b)==8).sum()
A very simple and fast way to profile a single-threaded execution is:
# sort profiling result by time python -m cProfile -s time my_script.py > profiling
For further info see e.g. this Stackoverflow thread