From 9f9045123efefbd11dd397b4d59596290765feec Mon Sep 17 00:00:00 2001 From: "tompng (tomoya ishida)" Date: Sun, 11 Apr 2021 19:04:31 +0900 Subject: st.c: skip all deleted entries [Bug #17779] Update the start entry skipping all already deleted entries. Fixes performance issue of `Hash#first` in a certain case. --- benchmark/hash_first.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 benchmark/hash_first.yml (limited to 'benchmark') diff --git a/benchmark/hash_first.yml b/benchmark/hash_first.yml new file mode 100644 index 0000000000..c26df1a7ed --- /dev/null +++ b/benchmark/hash_first.yml @@ -0,0 +1,11 @@ +prelude: | + hash1 = 1_000_000.times.to_h { [rand, true]} + hash2 = hash1.dup + hash2.keys[1..100_000].each { hash2.delete _1 } + hash2.delete hash2.first[0] + +benchmark: + hash1: hash1.first + hash2: hash2.first + +loop_count: 100_000 -- cgit v1.2.3