Skip to content
Browse files

move benchmarking to a separate `lein benchmark` command

  • Loading branch information...
1 parent 18a1b4a commit 178e176921d718d68c4981a9281dad60e96879f3 @dakrone committed Dec 3, 2012
Showing with 24 additions and 21 deletions.
  1. +1 −0 .travis.yml
  2. +3 −1 ChangeLog.md
  3. +3 −4 README.md
  4. +9 −9 {test → benchmarks}/cheshire/test/benchmark.clj
  5. +8 −7 project.clj
View
1 .travis.yml
@@ -1,5 +1,6 @@
language: clojure
lein: lein2
+script: lein2 test :all
branches:
only:
- master
View
4 ChangeLog.md
@@ -1,7 +1,9 @@
## Changes between Cheshire 5.0.0 and 5.0.1
-No changes yet.
+* Protocol custom encoders now take precedence over regular map
+ encoders.
+* Benchmarking is now a separate lein command, not a test selector.
## Changes between Cheshire 5.0.0 and 4.0.x
View
7 README.md
@@ -298,10 +298,9 @@ to true:
<del>Benchmarks for custom encoding coming soon.</del> - check out the
-benchmarks in `cheshire.test.benchmark`; or run `lein test
-:benchmark`. If you have scenarios where Cheshire is not performing as
-well as expected (compared to a different library), please let me
-know.
+benchmarks in `cheshire.test.benchmark`; or run `lein benchmark`. If
+you have scenarios where Cheshire is not performing as well as
+expected (compared to a different library), please let me know.
## Advanced customization for factories
See
View
18 test/cheshire/test/benchmark.clj → benchmarks/cheshire/test/benchmark.clj
@@ -21,26 +21,26 @@
"set" #{"a" "b"}
"keyword" :foo})
-(deftest ^{:benchmark true} t-bench-clj-json
+(deftest t-bench-clj-json
(println "-------- clj-json Benchmarks --------")
(bench/with-progress-reporting
- (bench/bench (clj-json/parse-string
- (clj-json/generate-string test-obj)) :verbose))
+ (bench/quick-bench (clj-json/parse-string
+ (clj-json/generate-string test-obj)) :verbose))
(println "-------------------------------------"))
-(deftest ^{:benchmark true} t-bench-clojure-json
+(deftest t-bench-clojure-json
(println "-------- Data.json Benchmarks -------")
(bench/with-progress-reporting
- (bench/bench (cj/read-str (cj/write-str test-obj)) :verbose))
+ (bench/quick-bench (cj/read-str (cj/write-str test-obj)) :verbose))
(println "-------------------------------------"))
-(deftest ^{:benchmark true} t-bench-core
+(deftest t-bench-core
(println "---------- Core Benchmarks ----------")
(bench/with-progress-reporting
- (bench/bench (core/decode (core/encode test-obj)) :verbose))
+ (bench/quick-bench (core/decode (core/encode test-obj)) :verbose))
(println "-------------------------------------"))
-(deftest ^{:benchmark true} t-bench-custom
+(deftest t-bench-custom
(println "--------- Custom Benchmarks ---------")
(custom/add-encoder java.net.URL custom/encode-str)
(is (= "\"http://foo.com\"" (core/encode (java.net.URL. "http://foo.com"))))
@@ -50,7 +50,7 @@
(bench/quick-bench (core/decode (core/encode custom-obj)) :verbose)))
(println "-------------------------------------"))
-(deftest ^{:benchmark true} t-bench-custom-kw-coercion
+(deftest t-bench-custom-kw-coercion
(println "---- Custom keyword-fn Benchmarks ---")
(let [t (core/encode test-obj)]
(println "[+] (fn [k] (keyword k))")
View
15 project.clj
@@ -8,17 +8,18 @@
:dependencies [[com.fasterxml.jackson.core/jackson-core "2.1.1"]
[com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.1.1"]]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.4.0"]
- [criterium "0.3.0"]
- [org.clojure/test.generative "0.1.4"]
- [org.clojure/data.json "0.2.0"]
- [clj-json "0.5.0"]]}
+ [org.clojure/test.generative "0.1.4"]]}
:1.2 {:dependencies [[org.clojure/clojure "1.2.1"]]}
:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
- :1.5 {:dependencies [[org.clojure/clojure "1.5.0-beta1"]]}}
- :aliases {"all" ["with-profile" "dev,1.2:dev,1.3:dev:dev,1.5"]}
+ :1.5 {:dependencies [[org.clojure/clojure "1.5.0-beta1"]]}
+ :benchmark {:test-paths ["benchmarks"]
+ :dependencies [[criterium "0.3.1"]
+ [org.clojure/data.json "0.2.1"]
+ [clj-json "0.5.0"]]}}
+ :aliases {"all" ["with-profile" "dev,1.2:dev,1.3:dev:dev,1.5"]
+ "benchmark" ["with-profile" "dev,benchmark" "test"]}
:test-selectors {:default #(and (not (:benchmark %))
(not (:generative %)))
- :benchmark :benchmark
:generative :generative
:all (constantly true)}
:jvm-opts ["-Xmx512M"])

0 comments on commit 178e176

Please sign in to comment.
Something went wrong with that request. Please try again.