Created
December 12, 2009 03:51
-
-
Save marktriggs/254723 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; now even dumber :P | |
| (defn dumbest-split [#^String s c #^"[Ljava.lang.String;" tokens] | |
| (loop [start (int 0) | |
| i (int 0)] | |
| (let [idx (int (.indexOf s (int c) (int start)))] | |
| (if (neg? idx) | |
| (do (aset tokens i (.substring s start)) | |
| tokens) | |
| (do (aset tokens i (.substring s start idx)) | |
| (recur (inc idx) (inc i))))))) | |
| .split | |
| "Elapsed time: 1852.914773 msecs" | |
| dumb split | |
| "Elapsed time: 1136.352235 msecs" | |
| dumber split | |
| "Elapsed time: 691.229164 msecs" | |
| dumbest split | |
| "Elapsed time: 418.799226 msecs" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment