Skip to content

Instantly share code, notes, and snippets.

@retronym
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retronym/3be212b836de6537cc1b to your computer and use it in GitHub Desktop.
Save retronym/3be212b836de6537cc1b to your computer and use it in GitHub Desktop.
% date; time (for i in {1..10}; do echo ../scala2/sandbox/perf/scala/*.scala; done) | ~/scala/2.11.6/bin/scalac -J-Xmx2G -d /tmp -Xresident 2>&1 | perl -pne 'print scalar(localtime()), " ";'
Thu Apr 23 20:30:37 AEST 2015
Thu Apr 23 20:30:38 2015
Thu Apr 23 20:30:43 2015 nsc>
Thu Apr 23 20:30:45 2015 nsc>
Thu Apr 23 20:30:46 2015 nsc>
Thu Apr 23 20:30:48 2015 nsc>
Thu Apr 23 20:30:49 2015 nsc>
Thu Apr 23 20:30:50 2015 nsc>
Thu Apr 23 20:30:51 2015 nsc>
Thu Apr 23 20:30:52 2015 nsc>
Thu Apr 23 20:30:53 2015 nsc>
Thu Apr 23 20:30:54 2015 nsc>
Thu Apr 23 20:30:54 2015 nsc>
real 0m16.599s
user 0m48.036s
sys 0m2.730s
% time ~/scala/2.11.6/bin/scalac -J-NOJVM -d ../scala2/sandbox/perf/scala/*.scala 2>&1 # 2000 files
Unrecognized option: -NOJVM
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
real 0m10.389s
user 0m10.293s
sys 0m0.067s
% time bash sandbox/test /foo/bar/foo/bar/foo/bar/foo/bar/{1..2000}
real 0m9.082s
user 0m9.050s
sys 0m0.020s
% time bash sandbox/test /foo/bar/foo/bar/foo/bar/foo/bar/{1..1000}
real 0m2.250s
user 0m2.241s
sys 0m0.007s
% time bash sandbox/test /foo/bar/foo/bar/foo/bar/foo/bar/{1..1000}
real 0m2.244s
user 0m2.236s
sys 0m0.007s
% time bash sandbox/test /foo/bar/foo/bar/foo/bar/foo/bar/{1..2000}
real 0m9.051s
user 0m9.026s
sys 0m0.017s
% time bash sandbox/test /foo/bar/foo/bar/foo/bar/foo/bar/{1..3000}
real 0m20.623s
user 0m20.532s
sys 0m0.050s
% time bash sandbox/test /foo/bar/foo/bar/foo/bar/foo/bar/{1..4000}
real 0m36.581s
user 0m36.443s
sys 0m0.108s
#!/bin/bash
# Minimized from scalac bach wrapper. This pattern of command line processing shows quadratic performance.
# It was introduced https://github.com/scala/scala/commit/fbe897d165bfbb8cda05e4b25f0f773288653f54
declare -a scala_args
while [[ $# -gt 0 ]]; do
case "$1" in
-D*)
shift
;;
-J*)
shift
;;
-toolcp)
shift 2
;;
-nobootcp)
unset usebootcp
shift
;;
-usebootcp)
usebootcp="true"
shift
;;
-debug)
SCALA_RUNNER_DEBUG=1
shift
;;
*)
scala_args=("${scala_args[@]}" "$1")
shift
;;
esac
done
# reset "$@@" to the remaining args
set -- "${scala_args[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment