Skip to content

Commit 1c7c678

Browse files
committed
Better documentation
1 parent e390545 commit 1c7c678

File tree

2 files changed

+50
-45
lines changed

2 files changed

+50
-45
lines changed

bin/lc-stress-tests-jar.sh

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,45 @@ struct_sizes=(0 1 8 16 32 64 256 1024)
44

55
jvm_opts="-server -Xms8g -Xmx8g -XX:+UseZGC"
66

7+
# each job completion runs in an isolated pod/container, JOB_COMPLETION_INDEX identifies the pod/container
8+
# this will run a single test per pod, then destroy it
79
for size in "${struct_sizes[@]}"; do
810
case $JOB_COMPLETION_INDEX in
9-
0|1)
10-
if (( JOB_COMPLETION_INDEX == 0)); then
11-
java $jvm_opts -jar bin/fressian-old.jar "vec" ${size} false
12-
else
13-
java $jvm_opts -jar bin/fressian-old.jar "map" ${size} false
14-
fi
15-
;;
16-
2|3)
17-
if (( JOB_COMPLETION_INDEX == 2)); then
18-
java $jvm_opts -jar bin/fressian-convert.jar "vec" ${size} false
19-
else
20-
java $jvm_opts -jar bin/fressian-convert.jar "map" ${size} false
21-
fi
22-
;;
23-
4|5)
24-
if (( JOB_COMPLETION_INDEX == 4)); then
25-
java $jvm_opts -jar bin/fressian-convert.jar "vec" ${size} true
26-
else
27-
java $jvm_opts -jar bin/fressian-convert.jar "map" ${size} true
28-
fi
29-
;;
30-
6|7)
31-
if (( JOB_COMPLETION_INDEX == 6)); then
32-
java $jvm_opts -jar bin/fressian-reduce.jar "vec" ${size} false
33-
else
34-
java $jvm_opts -jar bin/fressian-reduce.jar "map" ${size} false
35-
fi
36-
;;
37-
8|9)
38-
if (( JOB_COMPLETION_INDEX == 8)); then
39-
java $jvm_opts -jar bin/fressian-reduce.jar "vec" ${size} true
40-
else
41-
java $jvm_opts -jar bin/fressian-reduce.jar "map" ${size} true
42-
fi
43-
;;
44-
10|11)
45-
if (( JOB_COMPLETION_INDEX == 10)); then
46-
java $jvm_opts -jar bin/fressian-reducemap.jar "vec" ${size} true
47-
else
48-
java $jvm_opts -jar bin/fressian-reducemap.jar "map" ${size} true
49-
fi
11+
0)
12+
java $jvm_opts -jar bin/fressian-old.jar "vec" ${size} false
13+
;;
14+
1)
15+
java $jvm_opts -jar bin/fressian-old.jar "map" ${size} false
16+
;;
17+
2)
18+
java $jvm_opts -jar bin/fressian-convert.jar "vec" ${size} false
19+
;;
20+
3)
21+
java $jvm_opts -jar bin/fressian-convert.jar "map" ${size} false
22+
;;
23+
4)
24+
java $jvm_opts -jar bin/fressian-convert.jar "vec" ${size} true
25+
;;
26+
5)
27+
java $jvm_opts -jar bin/fressian-convert.jar "map" ${size} true
28+
;;
29+
6)
30+
java $jvm_opts -jar bin/fressian-reduce.jar "vec" ${size} false
31+
;;
32+
7)
33+
java $jvm_opts -jar bin/fressian-reduce.jar "map" ${size} false
34+
;;
35+
8)
36+
java $jvm_opts -jar bin/fressian-reduce.jar "vec" ${size} true
37+
;;
38+
9)
39+
java $jvm_opts -jar bin/fressian-reduce.jar "map" ${size} true
40+
;;
41+
10)
42+
java $jvm_opts -jar bin/fressian-reducemap.jar "vec" ${size} true
43+
;;
44+
11)
45+
java $jvm_opts -jar bin/fressian-reducemap.jar "map" ${size} true
5046
;;
5147
esac
5248
done

dev/aux.clj

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,31 @@
5555
~@body
5656
(- (System/nanoTime) st#)))
5757

58-
(defn stress-test [{:keys [struct-type struct-size convert-list?] :as argmap}
59-
read-handlers]
58+
(defn stress-test
59+
"Benchmarks Fressian reading for 20 minutes, repeatedly reading a collection of structs.
60+
Generates a log message at the end with total runs and processing time.
61+
62+
Receives argmap and a collection of Fressian read handlers
63+
- struct-type can be map or vec
64+
- struct-size is an arbitrary positive integer - if less than 9, repeated reading will use a collection of 1,000
65+
structs, else it will use a collection of 100,000 to avoid sub-millisecond measurement as the JVM doesn't promise
66+
sub-millisecond resolution
67+
- convert-list? determines whether reading will use custom read handlers or defaults"
68+
[{:keys [struct-type struct-size convert-list?] :as argmap}
69+
read-handlers]
6070
(let [gen-struct-fn (case (str struct-type)
6171
"map" gen-map
6272
"vec" gen-vec)
6373
fr-handlers (when convert-list? read-handlers)]
6474
(info (merge {:event :starting-stress-test} argmap))
6575
(let [work-chan (async/chan 1)
6676
timeout-chan (async/timeout (* 1000 60 20))
67-
; avoid submillisecond measurement
6877
struct-count (* 1000 (if (< struct-size 9)
6978
100 1))]
7079
(loop [runs 0
7180
proc-time 0]
7281
(let [structs (repeatedly struct-count #(gen-struct-fn struct-size))
73-
; put generated structs fressianed into the work channel as a single coll
82+
; put generated structs fressianed into the work channel as a single, eager vector
7483
_ (async/put! work-chan (into [] (for [st structs] (fressian st))))
7584
[val port] (async/alts!! [work-chan timeout-chan])]
7685
(cond

0 commit comments

Comments
 (0)