This is inspired by Julia Evans and Kamal Marhubi’s excellent mini-quiz on the data rates of systems and components.

The below cheatsheet serves as a summary of those benchmark speeds, for at-a-glance consumption.

Orders of magnitude

The idea is not necessarily know the exact figures for a particular benchmark, just the right order of magnitude.

🐌 100 1

πŸ¦₯ 101 10

🚢 102 100

πŸƒβ€β™€οΈ 103 1,000

πŸ‡β€ 104 10,000

β€πŸŽοΈπŸ’¨ 105 100,000

🚁 106 1,000,000

✈️ 107 10,000,000

πŸš€ 108 100,000,000

🌠 109 1,000,000,000

β€˜How much can be done in a second’

sum.c

  • Each loop adds to total
  • How many loop iterations per second?
    • πŸš€ - 🌠
    • Between 100 million and 1 Billion
    • 108 > and < 109

loop.py

  • Empty loop contents
  • How many loop iterations per second?
    • ✈️ - πŸš€
    • Between 10m and 100m
    • 107 > and < 108

dict.py

  • Add elements to a fixed-size dictionary
  • How many loop iterations per second?
    • ✈️ - πŸš€
    • Between 10m and 100m
    • 104 > and < 105

parse_http_request.py

  • Using Python built-in HTTP request parser
  • How many HTTP requests parsed per second?
    • πŸ‡β€οΈ - β€πŸŽοΈπŸ’¨β€
    • Between 10,000 and 100,000
    • 104 > and < 105

download_webpage.py

  • Downloading with urllib2
  • How many HTTP requests completed per second?
    • πŸŒβ€οΈ - ‍πŸ¦₯
    • Between 1 and 10
    • The true cost depends on size, connection speed and distance from servers

run_python.sh

  • Running Python script(s) from bash
  • Bash loop iterations per second
    • πŸ¦₯ - β€πŸšΆβ€
    • Between 10 and 100
    • 101 > and < 102

write_to_disk.py

  • Code run on a machine with an SSD
  • How many bytes written to disk in a second
    • πŸš€ - 🌠
    • Between 100 million and 1 Billion
  • How many megabytes written to disk in a second
    • 🚢 - πŸƒβ€β™€οΈ
    • Between 100 and 1,000
    • My T480s running Ubuntu with SSD reports write speed: 2.3 GB/s and read 673 MB/s 1

write_to_memory.py

  • How many bytes written to a string in memory in a second
    • 🌠+
    • Above 1 Billion

grep_bytes.sh

  • Bytes search in a second
    • 🌠+
    • Above 1 Billion

find-filenames.sh

  • Files come from the filesystem cache
  • How many files listed in one second?
    • πŸŽπŸ’¨ - β€πŸš
    • Between 100,000 and 1m
    • 105 > and < 106
    • Grep can search at 2GB/s so more limited by disk speed than grep’s speed

json_parse.py

  • Deserializing the same 65k of JSON repeatedly
  • How many loop iterations in a second?
    • 🚢 - β€πŸƒβ€β™€οΈ
    • Between 100 and 1,000
    • 102 > and < 103

msgpack_parse.py

  • Parse 46k of msgpack data
  • How many loop iterations in a second?
    • πŸƒβ€β™€οΈ - β€πŸ‡β€
    • Between 1,000 and 10,000
    • 103 > and < 104
    • Your choice of format and deserialisation library (eg capnproto) makes a big difference

database_indexed.py

  • Select one row from an indexed sqlite table containing 10m rows
  • How many queries in one second
    • β€πŸ‡β€ - πŸŽοΈπŸ’¨
    • Between 10,000 and 100,000
    • 104 > and < 105
    • Typical query in 20 microseconds

database_unindexed.py

  • Select one row from an unindexed sqlite table containing 10m rows
  • How many queries in one second
    • πŸŒβ€οΈ - ‍πŸ¦₯
    • Between 1 and 10
    • 100 > and < 101

hash.py

  • How many bytes hashed in one second?
    • πŸš€ - 🌠
    • Between 100 million and 1 Billion
    • 108 > and < 109
    • MD5 is designed to be fast

bcrypt_hash.py

  • Number of passwords hashed in a second?
    • πŸŒβ€οΈ - ‍πŸ¦₯
    • Between 1 and 10
    • 100 > and < 101

fill_array.c

  • Memory is accessed sequentially from a CPU cache
  • Number of passwords hashed in a second?
    • πŸš€ - 🌠
    • Between 100 million and 1 Billion
    • 108 > and < 109

fill_array.c

  • Number of passwords hashed in a second?
    • ✈️ - πŸš€
    • Between 10m and 100m
    • 104 > and < 105

Resources used: with thanks πŸ’š

  • Do you know how much your computer can do in a second? - Mini Quiz