Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 8752392b61b1b39c0898b16f9d8cd8004013ad30 @michalmarczyk committed Apr 16, 2012
Showing with 70 additions and 0 deletions.
  1. +12 −0 .gitignore
  2. +16 −0 README.md
  3. +14 −0 project.clj
  4. +28 −0 src/cljs/phm.cljs
@@ -0,0 +1,12 @@
+/target
+/lib
+/classes
+/checkouts
+pom.xml
+*.jar
+*.class
+.lein-deps-sum
+.lein-failures
+.lein-plugins
+.lein-cljsbuild-compiler-*
+/phm.js
@@ -0,0 +1,16 @@
+# cljs-persistent-hash-map-test
+
+A bunch of helper functions with which to build jsPerf tests for the
+ClojureScript port of Clojure's PersistentHashMap.
+
+## Usage
+
+See the JIRA ticket:
+
+http://dev.clojure.org/jira/browse/CLJS-178
+
+## License
+
+Copyright © 2012 Michał Marczyk
+
+Distributed under the Eclipse Public License, the same as Clojure.
@@ -0,0 +1,14 @@
+(defproject cljs-persistent-hash-map-test "0.0.1-SNAPSHOT"
+ :description "Perf tests for ClojureScript port of Clojure's PersistentHashMap"
+ :license {:name "Eclipse Public License"
+ :url "http://www.eclipse.org/legal/epl-v10.html"}
+ :source-path "src/clj/"
+ :dependencies [[org.clojure/clojure "1.3.0"]
+ ;; locally built from
+ ;; https://github.com/michalmarczyk/clojurescript/tree/phm2
+ [org.clojure/clojurescript "0.0-1078"]]
+ :plugins [[lein-cljsbuild "0.1.7"]]
+ :cljsbuild {:builds [{:source-path "src/cljs/"
+ :compiler {:output-to "phm.js"
+ :optimizations :advanced
+ :pretty-print false}}]})
@@ -0,0 +1,28 @@
+(ns phm)
+
+(defn ^:export empty-obj-map []
+ cljs.core.ObjMap/EMPTY)
+
+(defn ^:export empty-hash-map []
+ cljs.core.HashMap/EMPTY)
+
+(defn ^:export empty-persistent-hash-map []
+ cljs.core.PersistentHashMap/EMPTY)
+
+(defn ^:export assocwrapper [m k v]
+ (assoc m k v))
+
+(defn ^:export dissocwrapper [m k]
+ (dissoc m k))
+
+(defn ^:export getwrapper [m k]
+ (get m k))
+
+(defn ^:export getwrapperdefault [m k not-found]
+ (get m k not-found))
+
+(defn ^:export invokewrapper [m k]
+ (m k))
+
+(defn ^:export invokewrapperdefault [m k not-found]
+ (m k not-found))

0 comments on commit 8752392

Please sign in to comment.