mirror of
https://github.com/circify/circ.git
synced 2026-01-14 16:17:54 -05:00
I split the hash-consing implementation into its own crate and re-implemented it. In the new implementation, the table is thread-local. Terms are not Send, but linear terms are. Decreased used of atomics gives a non-trivial speed-up. I tested on Z#'s sha2 round function, with an exit after IR optimization: Benchmark #1: ./circ-old third_party/ZoKrates/zokrates_stdlib/stdlib/hashes/sha256/shaRound.zok r1cs Time (mean ± σ): 236.2 ms ± 16.1 ms [User: 223.3 ms, System: 12.4 ms] Range (min … max): 221.1 ms … 264.1 ms 11 runs Benchmark #2: ./circ-new third_party/ZoKrates/zokrates_stdlib/stdlib/hashes/sha256/shaRound.zok r1cs Time (mean ± σ): 141.8 ms ± 13.1 ms [User: 131.3 ms, System: 10.0 ms] Range (min … max): 125.4 ms … 160.4 ms 18 runs Summary './circ-new third_party/ZoKrates/zokrates_stdlib/stdlib/hashes/sha256/shaRound.zok r1cs' ran 1.67 ± 0.19 times faster than './circ-old third_party/ZoKrates/zokrates_stdlib/stdlib/hashes/sha256/shaRound.zok r1cs'
49 lines
1.3 KiB
Makefile
49 lines
1.3 KiB
Makefile
raw_template = src/raw/template.rs
|
|
raw_u8 = src/raw/example_u8.rs
|
|
raw_macro = src/raw/macro_.rs
|
|
raw_gen = $(raw_macro) $(raw_u8)
|
|
hashconsing_template = src/hashconsing/template.rs
|
|
hashconsing_u8 = src/hashconsing/example_u8.rs
|
|
hashconsing_macro = src/hashconsing/macro_.rs
|
|
hashconsing_gen = $(hashconsing_macro) $(hashconsing_u8)
|
|
rc_template = src/rc/template.rs
|
|
rc_u8 = src/rc/example_u8.rs
|
|
rc_macro = src/rc/macro_.rs
|
|
rc_gen = $(rc_macro) $(rc_u8)
|
|
|
|
.PHONY: test valgrind miri clean all
|
|
|
|
generated = $(raw_gen) $(hashconsing_gen) $(rc_gen)
|
|
|
|
all: $(generated)
|
|
|
|
$(raw_macro): generate_macro.zsh $(raw_template)
|
|
zsh $< $(raw_template) $@ generate_hashcons_raw
|
|
|
|
$(raw_u8): generate_u8.zsh $(raw_template)
|
|
zsh $< $(raw_template) $@
|
|
|
|
$(hashconsing_macro): generate_macro.zsh $(hashconsing_template)
|
|
zsh $< $(hashconsing_template) $@ generate_hashcons_hashconsing
|
|
|
|
$(hashconsing_u8): generate_u8.zsh $(hashconsing_template)
|
|
zsh $< $(hashconsing_template) $@
|
|
|
|
$(rc_macro): generate_macro.zsh $(rc_template)
|
|
zsh $< $(rc_template) $@ generate_hashcons_rc
|
|
|
|
$(rc_u8): generate_u8.zsh $(rc_template)
|
|
zsh $< $(rc_template) $@
|
|
|
|
test: $(generated)
|
|
cargo test
|
|
|
|
valgrind: $(generated)
|
|
cargo valgrind test
|
|
|
|
miri: $(generated)
|
|
cargo +nightly miri test
|
|
|
|
clean:
|
|
cargo clean && rm -rf $(generated)
|