On 2013.07.06 10:37:49 -0500, Tommy M. McGuire wrote:
> When I updated my idiotic anagrams-hashmap toy to 0.7, I seem to have
> run across a weird performance regression involving hashmaps.
> 
> Previous runs took approximately 6 seconds, but the 0.7 build is 1)
> taking about 35 seconds and 2) very variable, since rebuilding it and
> sometimes just running it several more times results in smaller run
> times of ~22 seconds. Further, inserting some println's to look at what
> was taking so long reduced the run time to about 9 seconds.
> 
> It is not limited to that particular program; other versions seem to be
> affected as well, including anagrams-hashmap-mmap, which was just
> recently run with a post-incoming-change build of the master branch. (5
> seconds vs. 11 seconds.)
> 
> Any ideas what is going on?

Though I can't seem to run into the problem with varying runtimes, I
found out at least part of what's wrong with anagram-hashmap
(anagram-hashmap-mmap doesn't build with 0.6).

The problem is that in 0.7 almost all #[inline(always)] attributes got
replaced by just #[inline]. In your code, this causes the write and
result function for hashing not to be inlined. On its own, this is not a
problem, but unfortunately, that codepath triggers stack growth, which
is a problem.

doener@atjola:rust-toys (master) $ time ./anagrams-hashmap 
asdwtribnowplfglewhqabe
6675

real    0m5.724s
user    0m5.716s
sys     0m0.007s
doener@atjola:rust-toys (master) $ time RUST_MIN_STACK=8000000 
./anagrams-hashmap asdwtribnowplfglewhqabe
6675

real    0m1.453s
user    0m1.447s
sys     0m0.006s

This is still 50% slower than the 0.6 version, but I'm not sure yet
what's to blame for that. Might be the missing inlining, might be
something else.

Björn
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to