<commit_before>#! /usr/bin/env bash

PATH=node_modules/.bin:$PATH

set -e

bench () {
  name="$2"-"$3"
  echo "***************************************"
  echo "* running benchmark: $1 with $2"
  echo "***************************************"
  echo
  mkdir -p output/"$1"
  node bench-"$1".js "$2" "$3" | tee output/"$1"/"$name".csv
  echo
}

all () {
  # usage : all hash sha1

  bench "$1" crypto-browserify "$2"
  bench "$1" sjcl              "$2"
  bench "$1" crypto-js         "$2"
  bench "$1" forge             "$2"
  # these don't have all the hashes,
  # so continue if they fail
  bench "$1" jshashes          "$2" || true
  case "$2" in
    sha256 | ripemd )
      bench "$1" cryptomx          "$2"
    ;;
    sha1 )
      bench "$1" rusha          sha1
      bench "$1" git-sha1       sha1
    ;;
  esac
  # bench hash node
}

shorten () {
  # shorten column names, so that there is room on the graph legend.
  replace-stream /-[\\w\\d]+\\.[\\w\\/-_]+/ ''
}

graphs () {
  ls ./../dat-table/bin.js<commit_msg>Point toward node_modules directory<commit_after>#! /usr/bin/env bash

PATH=node_modules/.bin:$PATH

set -e

bench () {
  name="$2"-"$3"
  echo "***************************************"
  echo "* running benchmark: $1 with $2"
  echo "***************************************"
  echo
  mkdir -p output/"$1"
  node bench-"$1".js "$2" "$3" | tee output/"$1"/"$name".csv
  echo
}

all () {
  # usage : all hash sha1

  bench "$1" crypto-browserify "$2"
  bench "$1" sjcl              "$2"
  bench "$1" crypto-js         "$2"
  bench "$1" forge             "$2"
  # these don't have all the hashes,
  # so continue if they fail
  bench "$1" jshashes          "$2" || true
  case "$2" in
    sha256 | ripemd )
      bench "$1" cryptomx          "$2"
    ;;
    sha1 )
      bench "$1" rusha          sha1
      bench "$1" git-sha1       sha1
    ;;
  esac
  # bench hash node
}

shorten () {
  # shorten column names, so that there is room on the graph legend.
  replace-stream /-[\\w\\d]+\\.[\\w\\/-_]+/ ''
}

graphs () {
  ls ./node_modules/dat-table/bin.js
{'fraction_non_alphanumeric': 0.24108003857280616, 'fraction_numerical': 0.03085824493731919, 'mean_word_length': 2.182515337423313, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7066264', 'n_tokens_mistral': 767, 'n_tokens_neox': 742, 'n_words': 210}