ring-clojure / ring-json

Ring middleware for handling JSON
313 stars 47 forks source link

[#65] Replace slurp+parse-string with reader+parse-stream #66

Closed bsless closed 3 years ago

bsless commented 3 years ago

Closes #65 Criterium benchmarks to measure overhead:

(require
 '[criterium.core :as cc]
 '[ring.util.io :refer [string-input-stream]])

(let [handler (wrap-json-body identity)
      request  {:headers {"content-type" "application/json; charset=GBK"}
                :body (string-input-stream (String. (.getBytes "{\"foo\": \"你好\"}")) "GBK")}
      ]
  (cc/quick-bench
   (handler request)))

;;; stream Execution time mean : 5.752998 µs
;;; slurp Execution time mean : 10.297224 µs
atomist[bot] commented 3 years ago

Commit messages of this repository should follow the seven rules of a great Git commit message, as mentioned in the project's contributing guidelines. It looks like there's a few issues with the commit messages in this pull request:

bsless commented 3 years ago

Done all requested changes