Created
December 16, 2019 11:45
-
-
Save davidhq/e56be8bbeb03a8ab44038115feb3fbb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const v8 = require('v8'); | |
const dmt = require('dmt-bridge'); | |
const { stopwatch, util } = dmt; | |
//const clone = require('./fast-clone'); | |
const justClone = equire('./utilities/just/collection-clone'), | |
const state = require(dmt.dmtPath + '/state/program.json'); | |
function cloneJSONStringify(obj) { | |
return JSON.parse(JSON.stringify(obj)); | |
} | |
const structuredClone = obj => { | |
return v8.deserialize(v8.serialize(obj)); | |
}; | |
const timer = stopwatch.start(); | |
//const a = clone(state); | |
for (let i = 0; i < 1000; i++) { | |
let a = justClone(state); | |
//let a = structuredClone(state); | |
//let a = cloneJSONStringify(state); | |
} | |
const duration = stopwatch.stop(timer); | |
console.log(duration); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment