mozilla/rust — pull request #11546 by huonw (2014-01-15 01:01:51+00:00)
Title: std::trie: optimise insert

This reduces the number of moves/memcpy's we do, which makes insert
faster, especially in cases of keys with long equal prefixes (the
\_low_bits tests):

Before:

bench_insert_large ... bench: 553966 ns/iter (+/- 64050)
bench_insert_large_low_bits ... bench: 1048151 ns/iter (+/- 92484)
bench_insert_small ... bench: 168840 ns/iter (+/- 22410)
bench_insert_small_low_bits ... bench: 185069 ns/iter (+/- 38332)

After:

bench_insert_large ... bench: 422132 ns/iter (+/- 35112)
bench_insert_large_low_bits ... bench: 339083 ns/iter (+/- 34421)
bench_insert_small ... bench: 134539 ns/iter (+/- 15254)
bench_insert_small_low_bits ... bench: 88775 ns/iter (+/- 5746)

Notably: no unsafe code.