v1
- by jonasb 10/17/202200
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
class CustomMapWithOwnProperty {
  constructor(size) {
    this.count = 0;
    this.size = size;
    this.data = {};
  }

  getValue(key) {
    return this.data.hasOwnProperty(key) ? this.data[key] : null;
  }

  setValue(key, value) {
    if (this.count > this.size) {
      throw new RangeError('exceeded map size of', this.size);
    }
    this.data[key] = value;
    this.count++;
  }
}

class CustomFastMap {
  constructor(size) {
    this.count = 0;
    this.size = size;
    this.data = {};
  }

  getValue(key) {
    return this.data[key] || null;
  }

  setValue(key, value) {
    if (this.count > this.size) {
      throw new RangeError('exceeded map size of', this.size);
    }
    this.data[key] = value;
    this.count++;
  }
}

const es6Map256 = new Map();
const es6Map1024 = new Map();
const es6Map2048 = new Map();

const customMapWithOwnProperty256 = new CustomMapWithOwnProperty(256);
const customMapWithOwnProperty1024 = new CustomMapWithOwnProperty(1024);
const customMapWithOwnProperty2048 = new CustomMapWithOwnProperty(2056);

const customFastMap256 = new CustomFastMap(256);
const customFastMap1024 = new CustomFastMap(1024);
const customFastMap2048 = new CustomFastMap(2048);

for (let i = 0; i < 256; i++) {
  es6Map256.set('key-' + i, i);
  customMapWithOwnProperty256.setValue('key-' + i, i);
  customFastMap256.setValue('key-' + i, i);
}

for (let i = 0; i < 1024; i++) {
  es6Map1024.set('key-' + i, i);
  customMapWithOwnProperty1024.setValue('key-' + i, i);
  customFastMap1024.setValue('key-' + i, i);
}

for (let i = 0; i < 2048; i++) {
  es6Map2048.set('key-' + i, i);
  customMapWithOwnProperty2048.setValue('key-' + i, i);
  customFastMap2048.setValue('key-' + i, i);
}

delete caserun single casemove downdrag and drop case


ready



customMapWithOwnProperty256.getValue("key-" + 128);
delete caserun single casemove upmove downdrag and drop case


ready



customFastMap256.getValue("key-" + 128);
delete caserun single casemove upmove downdrag and drop case


ready



es6Map256.get("key-" + 128);
delete caserun single casemove upmove downdrag and drop case


ready



customMapWithOwnProperty1024.getValue("key-" + 512);
delete caserun single casemove upmove downdrag and drop case


ready



customFastMap1024.getValue("key-" + 512);
delete caserun single casemove upmove downdrag and drop case


ready



es6Map1024.get("key-" + 512);
delete caserun single casemove upmove downdrag and drop case


ready



customMapWithOwnProperty2048.getValue("key-" + 1024);
delete caserun single casemove upmove downdrag and drop case


ready



es6Map2048.get("key-" + 1024);
delete caserun single casemove updrag and drop case


ready



es6Map2048.get("key-" + 1024);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN