One insert in every n pays for the whole pass, so a table holding a million keys has one insert that moves a million keys. That shows up as a latency spike, and averaging it away is exactly what a request budget, a game frame or an audio callback cannot do. Code with a deadline either sizes the table up front, with HashMap.newHashMap(n) or reserve or make(map[K]V, n), or spreads the move across many operations instead of doing it in one. Watch the Java form: the HashMap(n) constructor takes a bucket count, not a key count, so passing the number of keys you expect still resizes once you pass 0.75 of it, which is why newHashMap was added.