Duplicate key access + key access vs Single key access + key access

Benchmark created on


Setup

var obj = {
	foo: {
		lastSeen: 123,
		totalCount: 5
	},
   bar: {
		lastSeen: 456,
		totalCount: 6
	},
   baz: {
		lastSeen: 789,
		totalCount: 7
	}	
};

Test runner

Ready to run.

Testing in
TestOps/sec
Duplicate key access + key access
obj['foo'].lastSeen = 999;
obj['foo'].totalCount = 9;
ready
Single key access + key access
var foo = obj['foo'];
foo.lastSeen = 999;
foo.totalCount = 9;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.