Skip to content

Instantly share code, notes, and snippets.

@ato
Created December 15, 2009 00:38
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 ato/ffc64fc2a18382dbfaf6 to your computer and use it in GitHub Desktop.
Save ato/ffc64fc2a18382dbfaf6 to your computer and use it in GitHub Desktop.
;; 40 MB/s
(let [rem (int (- (.remaining buffer) 4))]
(loop [i (int 0)]
(when (< i rem)
(.get buffer)
(.get buffer)
(.get buffer)
(.get buffer)
(recur (unchecked-add i 4)))))
;; 200 MB/s
(try
(loop []
(.get buffer)
(.get buffer)
(.get buffer)
(.get buffer)
(recur))
(catch java.nio.BufferUnderflowException e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment