Skip to content

Commit

Permalink
sort-ops benchmark works and passes for all array types
Browse files Browse the repository at this point in the history
  • Loading branch information
w01fe committed Jul 10, 2013
1 parent cb3e815 commit ff535ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions bin/dtoall.sh
@@ -1,4 +1,8 @@
#!/bin/bash

# Generate the type-specific Java Baseline and Helpers classes for float/int/long
# from the canonical double versions.

cd `dirname $0`
for out in float int long
do
Expand Down
19 changes: 10 additions & 9 deletions test/hiphip/type_impl_test.clj
Expand Up @@ -327,17 +327,18 @@

(deftestfasttype sort-ops
(java.util.Arrays/sort xs)
0.15 (hiphip/aselect xs (quot (alength xs) 2))
0.3 (hiphip/aselect xs (quot (alength xs) 10))
0.3 (hiphip/aselect xs 1)
0.1 (hiphip/aselect xs (quot (alength xs) 2))
0.2 (hiphip/aselect xs (quot (alength xs) 10))
0.2 (hiphip/aselect xs 1)
0.03 (hiphip/amax xs)
0.4 (hiphip/asort-max xs (quot (alength xs) 10))
0.3 (hiphip/asort-max xs (quot (alength xs) 10))
6.0 (hiphip/asort-indices xs)
1.5 (hiphip/amax-indices xs (quot (alength xs) 10))
0.7 (hiphip/amax-indices xs 5))
1.0 (hiphip/amax-indices xs (quot (alength xs) 10))
0.6 (hiphip/amax-indices xs 5))

(deftest ^:bench sort-ops-benc
(let [r (java.util.Random. 1)]
(sort-ops (double-array (repeatedly 10000 #(.nextInt r 1000000))) (double-array 10000))))
(deftest ^:bench sort-ops-bench
(let [r (java.util.Random. 1)
xs (hiphip/amake [_ 10000] (.nextInt r 1000000))]
(sort-ops xs xs)))

(set! *warn-on-reflection* false)

0 comments on commit ff535ec

Please sign in to comment.