Created
November 22, 2016 08:11
-
-
Save gaoxiaoliangz/b8c6715be8a2349a03cb7378250f3ded 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
var x1 = 'aaaaa\nbbbb\ncccc\n\nddd' | |
var y1 = '' | |
for (let i = 0; i < 100000; i++) { | |
y1 = y1 + x1 | |
} | |
const markAll = () => { | |
const t0 = new Date().valueOf() | |
marked(y1, { | |
gfm: true, | |
breaks: true | |
}) | |
const t1 = new Date().valueOf() | |
console.info(t1 - t0) | |
} | |
const markEach = () => { | |
const t0 = new Date().valueOf() | |
var xArr = y1.split('\n\n') | |
xArr.forEach(line => { | |
const html = marked(line, { | |
gfm: true, | |
breaks: true | |
}) | |
}) | |
const t1 = new Date().valueOf() | |
console.info(t1 - t0) | |
} | |
markAll() | |
markEach() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment