Skip to content

Instantly share code, notes, and snippets.

@gaoxiaoliangz
Created November 22, 2016 08:11
Show Gist options
  • Save gaoxiaoliangz/b8c6715be8a2349a03cb7378250f3ded to your computer and use it in GitHub Desktop.
Save gaoxiaoliangz/b8c6715be8a2349a03cb7378250f3ded to your computer and use it in GitHub Desktop.
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