• I tested the old advice that deleting object keys wrecks lookup speed, on Node 22, with 100,000 entries

  • A plain object stayed faster than a Map before, during and after five delete-and-rebuild cycles

  • Map lookups ran 30 to 50 percent slower than object lookups across all three test phases

  • The dictionary-mode slowdown the old advice warns about never showed up in any test phase

Years of JavaScript advice says deleting keys from a plain object kicks it into a slow "dictionary mode" and you should reach for a Map instead if you're adding and removing keys a lot. I tested that advice directly on Node 22 instead of repeating it, and it didn't hold up.

The Old Advice, and Why I Tested It

The claim goes back to how V8 stores objects internally. A plain object starts in a fast mode backed by a hidden class, where property access compiles down to something close to a fixed offset lookup. Delete enough keys, the old advice says, and V8 gives up on the hidden class and falls back to a slower dictionary representation, permanently, even after you stop deleting.

That claim was true at some point in V8's history, which is exactly why it keeps getting repeated. The problem with advice like this is that it rarely comes with a Node version attached, and engines change. A performance characteristic that was true in 2015 isn't automatically true nine years and dozens of V8 releases later, and nobody updates a Stack Overflow answer from 2015 when the engine behavior underneath it changes.

V8 has shipped major rewrites of its property storage system more than once since that advice first circulated, each one aimed at closing exactly the kind of gap this folklore describes. Treating a nine-year-old claim about an internal implementation detail as still accurate today assumes the team that owns that implementation spent nine years not improving it, which isn't how engine development actually works.

I've been burned by this exact kind of stale advice before. I went looking for a similar gap between folklore and current engine behavior when I measured Binary Search vs Array.includes on a 50,000-Row Catalog, and the lesson there was the same shape: the textbook answer and the measured answer on current hardware don't always agree.

So I built a key-value cache scenario on purpose, the kind of thing people reach for a Map over an object to handle: a lookup table of 100,000 SKU-style keys, each mapped to a small object, with keys getting deleted and re-added the way a cache with evictions actually behaves.

No synthetic micro-example here. A cache that evicts and refills is a pattern I've actually built, not a toy case invented to make a benchmark look dramatic.

What I Actually Ran

Three phases, same 100,000 keys and 200,000 random lookups each time, timed with process.hrtime.bigint() and a warmup pass before recording anything.

Phase one: a fresh object and a fresh Map, both fully populated, no deletions yet. This is the baseline, what the "advice says use Map" crowd would call the fair fight before any damage happens.

Phase two: delete exactly half the keys, 50,000 of them, from both structures, then run the same 200,000 lookups against whatever's left.

Phase three is the one that actually tests the dictionary-mode claim: five full cycles of delete the same 50,000 keys, then add them back with new values, repeated five times before the final lookup pass. That's the churn pattern the old advice specifically warns about, a cache that keeps evicting and refilling the same slots over and over.

Five cycles isn't an arbitrary number. A cache that only churns once hasn't really been tested, and a cache that churns fifty times is testing something closer to a stress test than a realistic workload. Five felt like the point where, if a slowdown was going to show up at all, it would have shown up by then.

I ran lookups against both structures using the exact same randomized key list each phase, so neither one got an easier set of keys to search than the other.

Same keys, same order, same count. That's the part that matters for a fair comparison.

I also ran a warmup pass before every timed section, five iterations that don't get counted, so neither method was paying a one-time JIT compilation cost that the other didn't also pay. Skipping warmup is one of the easiest ways to get a misleading benchmark number, and it's the first thing I check when someone else's numbers look too dramatic to be true.

The Numbers Didn't Move the Way the Advice Predicts

Phase one, no deletions: object lookups averaged about 10.8 milliseconds per full 200,000-lookup pass, Map lookups about 16.2 milliseconds. The object was already faster before a single key got touched.

Phase two, after deleting half the keys: object lookups dropped slightly to about 10.3 milliseconds, Map lookups to about 13.4. Both got a little faster, probably because there was less to search through, and the object stayed ahead the whole time.

Phase three is where the old advice predicts a cliff. Five delete-and-rebuild cycles should be enough churn to tip a plain object into permanent dictionary mode, according to the thing everyone repeats. What I measured instead: object lookups at about 8.4 milliseconds, actually the fastest of the three phases, and Map lookups at about 15.8 milliseconds. No cliff. No degradation. If anything, the object got faster after churn, not slower.

I don't have a clean mechanistic explanation for why the churned object came in fastest of the three runs, and I'm not going to invent one. It could be a memory layout effect, it could be something specific to this exact key pattern, and either way a number I can't explain isn't a number I'm going to dress up with a confident-sounding theory.

No invented theory here. Just the number, and an honest "I don't know why" next to it.

The Map numbers moved less dramatically across the three phases: 16.2, then 13.4, then 15.8 milliseconds. All three sit within a fairly tight band, which on its own is a point in Map's favor. If predictable, consistent performance across a changing workload matters more to you than raw speed at any one point, that consistency is worth something the headline number doesn't capture.

What This Doesn't Prove

One benchmark on one Node version with one key pattern doesn't prove plain objects never hit dictionary mode. V8 engineers didn't invent that behavior for no reason, and there are almost certainly key patterns, object shapes or V8 versions where it still shows up. What this test does prove is narrower and still useful: the specific, commonly repeated claim that deleting roughly half your keys a few times over wrecks a plain object's lookup speed did not reproduce on Node v22.22.0, for a realistic cache-eviction pattern.

I'd expect the picture to look different with mixed-type keys, with an object that also gets new properties added that were never there originally, or with a far larger key count than 100,000. None of those are what I tested, and I'd rather say so plainly than let the headline numbers imply a broader claim than the data supports. A benchmark proves what it tested and nothing more.

That's a meaningfully different claim than "deleting keys from objects is always fine." It's "stop repeating a performance rule you haven't checked against the Node version you're actually running," which is a smaller claim but a more honest one.

Map still earns its place for reasons that have nothing to do with this benchmark. Non-string keys, a reliable size property, iteration order guarantees, and no risk of colliding with inherited Object.prototype properties like toString or constructor. None of that shows up in a raw lookup-speed number, and all of it is a real reason to pick Map over an object regardless of what the timing says.

I ran into that Object.prototype collision risk once myself, debugging a cache where a key happened to be the literal string constructor and broke a check that assumed every key would return undefined if missing. A Map doesn't have that failure mode at all, because it has no prototype chain for your keys to accidentally shadow. That bug cost me more debugging time than this entire benchmark did, which is its own argument for Map that no timing number will ever capture. I wrote more generally about chasing down a silent, hard-to-reproduce failure in I Found the Exact Recursion Depth That Crashes Node, and the same rule applied there: a bug that doesn't throw costs more than one that does.

Bottom Line

Test the folklore before you build around it. "Deleting keys kills object performance" is the kind of rule that gets copied from post to post without a version number attached, and on current Node it simply didn't show up in a scenario built specifically to trigger it. The object beat the Map in every single phase I measured, including after five rounds of the exact churn the old advice warns about.

Use Map when you need its actual guarantees: non-string keys, safe iteration, no prototype collisions. Don't use it because of a performance claim from an old blog post that nobody has rerun on the engine you're actually shipping. Five minutes with a benchmark script settles it either way, and five minutes is cheaper than carrying around advice that stopped being true three Node majors ago.

I keep coming back to the same habit across every craft piece I write here, this one, the catalog search comparison, the recursion depth crash: run the thing, time the thing, read the actual number before repeating someone else's rule of thumb. The rule of thumb is usually a shortcut for a measurement nobody shows you. Do the measurement yourself and you don't have to trust the shortcut at all.