Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Improved benchmarking script (I just wasn’t thinking carefully at the time, just getting something out quick; but eval is obviously better than requiring a function):

  try() {
      echo -e "\e[32;1m$1\e[m"
      for (( run = 0; run < 5; run++ )); do
          time (for (( i = 0; i < 1000; i++ )); do
              eval $1
          done)
      done
  }

  try "/usr/bin/echo .dump | true"
  try          "echo .dump | true"
  try            "<<<.dump   true"
  try                       "true"


I also want to note that this is thoroughly into the nanowatt-hour scale (even at the unrealistically low figure of 1W power consumption, 300μs makes it 83⅓ nWh). Tens or hundreds of thousands of picowatt-hours!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: