Skip to content

Instantly share code, notes, and snippets.

@dakrone
Created April 9, 2009 18:09
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 dakrone/92640 to your computer and use it in GitHub Desktop.
Save dakrone/92640 to your computer and use it in GitHub Desktop.
(ns timetest
(:use clojure.contrib.shell-out))
; Execute and return a list of lines, think of it as a helper for (sh)
(defn sh-lines
"Given a program and a list of args, run it and return an array
of the lines for stdout"
[& body]
(.split (:out (apply sh :return-map true body)) "\n"))
; 'echo_million' just prints a million lines to the screen
(time
(doseq [l (sh-lines "echo_million.rb")]
(empty? l)))
; java.lang.OutOfMemoryError: GC overhead limit exceeded (NO_SOURCE_FILE:0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment