Skip to content

Commit

Permalink
hotfix: don't pre-size hashmap in Rewriter
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugobros3 committed Jun 19, 2024
1 parent 2400342 commit 0b7694d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/thorin/transform/rewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
namespace thorin {

Rewriter::Rewriter(World& src, World& dst) : src_(src), dst_(dst) {
old2new_.rehash(src.defs().capacity());
// TODO: rehash is slow-ish, especially in Debug mode
// Many short-lived Rewriters are created that only rebuild a tiny portion of the
// world, such as in CondEval. For these, we end up paying a significant amount
// of time just running this, leading to bad performance. Be smarter or don't do this.
//old2new_.rehash(src.defs().capacity());
}

Rewriter::Rewriter(World& src, World& dst, Rewriter& parent) : Rewriter(src, dst) {
Expand Down

0 comments on commit 0b7694d

Please sign in to comment.