simple bench scripts for dmenu/awk/sort/..
authorDieter Plaetinck <dieter@plaetinck.be>
Sat, 25 Apr 2009 08:14:01 +0000 (10:14 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Sat, 25 Apr 2009 08:14:01 +0000 (10:14 +0200)
misc/dmenu-performancetest-bench.sh [new file with mode: 0755]
misc/dmenu-performancetest-generate-dummy-history-file.sh [new file with mode: 0755]

diff --git a/misc/dmenu-performancetest-bench.sh b/misc/dmenu-performancetest-bench.sh
new file mode 100755 (executable)
index 0000000..c06df46
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+echo "Run this test more then once. the first read on the file may be uncached. after that, the file is in Linux' block cache"
+
+echo "Plain awk '{print \$3}':"
+time awk '{print $3}' dummy_history_file >/dev/null
+
+echo "awk + sort"
+time awk '{print $3}' dummy_history_file | sort >/dev/null
+echo "awk + sort + uniq"
+time awk '{print $3}' dummy_history_file | sort | uniq >/dev/null
+
+echo "Plain dmenu:"
+dmenu < dummy_history_file
+echo "awked into dmenu:"
+awk '{print $3}' dummy_history_file | dmenu
+echo "awk + sort + uniq into dmenu:"
+awk '{print $3}' dummy_history_file | sort | uniq | dmenu
diff --git a/misc/dmenu-performancetest-generate-dummy-history-file.sh b/misc/dmenu-performancetest-generate-dummy-history-file.sh
new file mode 100755 (executable)
index 0000000..7650b46
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+echo "Creating dummy file of 50MB in size (625000 entries of 80chars)"
+entries_per_iteration=1000
+for i in `seq 1 625`
+do
+       echo "Iteration $i of 625 ( $entries_per_iteration each )"
+       for j in `seq 1 $entries_per_iteration`
+       do
+               echo "`date +'%Y-%m-%d %H:%M:%S'` `date +%s`abcdefhijklmno`date +%s | md5sum`" >> ./dummy_history_file
+       done
+done