Test case details

Preparation Code

var map = new Map();     var obj1 = Object.create(null);     var obj2 = {};         for (var i = 0; i < 1000; i++) {        var key = '' + Math.random(), val = '' + Math.random();                map.set(key, val);        obj1[key] = val;        obj2[key] = val;     }

Test cases

Test #1

var buf = ''; for (var key in obj1) {     buf += obj1[key]; }

Test #2

var buf = ''; for (var key in obj2) {     buf += obj2[key]; }

Test #3

var buf = ''; var keys = map.keys(); for (var key of keys) {     buf += map.get(key); }

Test #4

var buf = ''; var vals = map.values(); for (var val of vals) {     buf += val; }

Test #5

var buf = ''; map.forEach(function (key, val) {     buf += val; });