-
-
Save cursive-ide/d7e490bd875d575ff485518195aa1e19 to your computer and use it in GitHub Desktop.
This file contains 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
; Good example from https://stuartsierra.com/2016/clojure-how-to-ns.html | |
(def ns-good '(ns com.example.my-application.server | |
"Example application HTTP server and routing." | |
(:refer-clojure :exclude [send]) | |
(:require | |
[clojure.core.async :as async :refer [<! <!! >! >!!]] | |
[com.example.my-application.base] | |
[com.example.my-application.server.sse :as server.sse] | |
[io.pedestal.http :as http] | |
[io.pedestal.http.sse :as http.sse] | |
[ring.util.response :as response]) | |
(:import | |
(java.nio.file Files LinkOption) | |
(org.apache.commons.io FileUtils)))) | |
; Parses, but bad style (e.g. prefix lists) | |
(def ns-bad '(ns com.example.my-application.server | |
"Example application HTTP server and routing." | |
[:refer-clojure :exclude [send]] | |
[:require | |
[clojure.core.async :as async :refer [<! <!! >! >!!]] | |
(com.example (my-application base (server sse)) server) | |
[io.pedestal.http :as http] | |
[io.pedestal.http.sse :as http.sse] | |
[ring.util.response :as response]] | |
[:import | |
[java.nio.file Files LinkOption] | |
[org.apache.commons.io FileUtils]])) | |
; Yuk | |
(def ns-gen-class '(ns backtype.storm.testing4j | |
(:import [java.util Map List Collection ArrayList]) | |
(:import [backtype.storm Config ILocalCluster LocalCluster]) | |
(:import [backtype.storm.generated StormTopology]) | |
(:import [backtype.storm.daemon nimbus]) | |
(:import [backtype.storm.testing TestJob MockedSources TrackedTopology | |
MkClusterParam CompleteTopologyParam MkTupleParam]) | |
(:import [backtype.storm.utils Utils]) | |
(:use [backtype.storm testing util log]) | |
(:gen-class | |
:name backtype.storm.Testing | |
:methods [^:static [completeTopology | |
[backtype.storm.ILocalCluster backtype.storm.generated.StormTopology | |
backtype.storm.testing.CompleteTopologyParam] | |
java.util.Map] | |
^:static [completeTopology | |
[backtype.storm.ILocalCluster backtype.storm.generated.StormTopology] | |
java.util.Map] | |
^:static [withSimulatedTime [Runnable] void] | |
^:static [withLocalCluster [backtype.storm.testing.TestJob] void] | |
^:static [withLocalCluster [backtype.storm.testing.MkClusterParam backtype.storm.testing.TestJob] void] | |
^:static [withSimulatedTimeLocalCluster [backtype.storm.testing.TestJob] void] | |
^:static [withSimulatedTimeLocalCluster [backtype.storm.testing.MkClusterParam backtype.storm.testing.TestJob] void] | |
^:static [withTrackedCluster [backtype.storm.testing.TestJob] void] | |
^:static [withTrackedCluster [backtype.storm.testing.MkClusterParam backtype.storm.testing.TestJob] void] | |
^:static [readTuples [java.util.Map String String] java.util.List] | |
^:static [readTuples [java.util.Map String] java.util.List] | |
^:static [mkTrackedTopology [backtype.storm.ILocalCluster backtype.storm.generated.StormTopology] backtype.storm.testing.TrackedTopology] | |
^:static [trackedWait [backtype.storm.testing.TrackedTopology] void] | |
^:static [trackedWait [backtype.storm.testing.TrackedTopology Integer] void] | |
^:static [advanceClusterTime [backtype.storm.ILocalCluster Integer Integer] void] | |
^:static [advanceClusterTime [backtype.storm.ILocalCluster Integer] void] | |
^:static [multiseteq [java.util.Collection java.util.Collection] boolean] | |
^:static [multiseteq [java.util.Map java.util.Map] boolean] | |
^:static [testTuple [java.util.List] backtype.storm.tuple.Tuple] | |
^:static [testTuple [java.util.List backtype.storm.testing.MkTupleParam] backtype.storm.tuple.Tuple]]))) | |
(bench (match ns-good re)) | |
Evaluation count : 979740 in 60 samples of 16329 calls. | |
Execution time mean : 63.427022 µs | |
Execution time std-deviation : 3.066219 µs | |
Execution time lower quantile : 60.410703 µs ( 2.5%) | |
Execution time upper quantile : 70.641869 µs (97.5%) | |
Overhead used : 1.845633 ns | |
Found 4 outliers in 60 samples (6.6667 %) | |
low-severe 4 (6.6667 %) | |
Variance from outliers : 35.1685 % Variance is moderately inflated by outliers | |
=> nil | |
(bench (s/conform (:args (s/get-spec 'clojure.core/ns)) (rest ns-good))) | |
Evaluation count : 132240 in 60 samples of 2204 calls. | |
Execution time mean : 465.390509 µs | |
Execution time std-deviation : 26.260116 µs | |
Execution time lower quantile : 438.545067 µs ( 2.5%) | |
Execution time upper quantile : 520.651314 µs (97.5%) | |
Overhead used : 1.845633 ns | |
Found 1 outliers in 60 samples (1.6667 %) | |
low-severe 1 (1.6667 %) | |
Variance from outliers : 41.7975 % Variance is moderately inflated by outliers | |
=> nil | |
(bench (match ns-bad re)) | |
Evaluation count : 1109400 in 60 samples of 18490 calls. | |
Execution time mean : 48.277650 µs | |
Execution time std-deviation : 2.114796 µs | |
Execution time lower quantile : 46.523195 µs ( 2.5%) | |
Execution time upper quantile : 53.408755 µs (97.5%) | |
Overhead used : 1.845633 ns | |
Found 7 outliers in 60 samples (11.6667 %) | |
low-severe 7 (11.6667 %) | |
Variance from outliers : 30.3058 % Variance is moderately inflated by outliers | |
=> nil | |
(bench (s/conform (:args (s/get-spec 'clojure.core/ns)) (rest ns-bad))) | |
Evaluation count : 123420 in 60 samples of 2057 calls. | |
Execution time mean : 507.384168 µs | |
Execution time std-deviation : 27.586128 µs | |
Execution time lower quantile : 476.579808 µs ( 2.5%) | |
Execution time upper quantile : 555.826432 µs (97.5%) | |
Overhead used : 1.845633 ns | |
=> nil | |
(bench (match ns-gen-class re)) | |
Evaluation count : 1080 in 60 samples of 18 calls. | |
Execution time mean : 59.814222 ms | |
Execution time std-deviation : 3.068468 ms | |
Execution time lower quantile : 57.119135 ms ( 2.5%) | |
Execution time upper quantile : 66.945850 ms (97.5%) | |
Overhead used : 1.845633 ns | |
Found 5 outliers in 60 samples (8.3333 %) | |
low-severe 5 (8.3333 %) | |
Variance from outliers : 36.8793 % Variance is moderately inflated by outliers | |
=> nil | |
(bench (s/conform (:args (s/get-spec 'clojure.core/ns)) (rest ns-gen-class))) | |
Evaluation count : 76680 in 60 samples of 1278 calls. | |
Execution time mean : 831.280994 µs | |
Execution time std-deviation : 62.604199 µs | |
Execution time lower quantile : 764.131859 µs ( 2.5%) | |
Execution time upper quantile : 991.703489 µs (97.5%) | |
Overhead used : 1.845633 ns | |
Found 2 outliers in 60 samples (3.3333 %) | |
low-severe 2 (3.3333 %) | |
Variance from outliers : 56.7709 % Variance is severely inflated by outliers | |
=> nil | |
bc 1.06 | |
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. | |
This is free software with ABSOLUTELY NO WARRANTY. | |
For details type `warranty'. | |
scale=2 | |
465.39 / 63.43 | |
7.33 | |
507.38 / 48.28 | |
10.50 | |
831.28 / 59.81 | |
13.89 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment