Created
March 25, 2011 04:07
-
-
Save kirbysayshi/886348 to your computer and use it in GitHub Desktop.
jsdom appears to favor its default parser vs another when they are used in the same script?
This file contains 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 jsdom = require('jsdom@0.2.0') | |
,fs = require('fs') | |
,testHtml = fs.readFileSync(__dirname + '/british_throne.html', 'utf8') | |
,html5 = require('html5') | |
,window | |
,document | |
,start = +new Date() | |
,end; | |
start = +new Date(); | |
window = jsdom.jsdom(testHtml, null, { | |
features: { | |
FetchExternalResources : false, | |
ProcessExternalResources: false, | |
QuerySelector: true, | |
MutationEvents: false | |
} | |
//,parser: html5 | |
}).createWindow(); | |
document = window.document; | |
end = +new Date(); | |
console.log( (end - start) + ' ms to load' ); | |
start = +new Date(); | |
window = jsdom.jsdom(testHtml, null, { | |
features: { | |
FetchExternalResources : false, | |
ProcessExternalResources: false, | |
QuerySelector: true, | |
MutationEvents: false | |
} | |
,parser: html5 | |
}).createWindow(); | |
document = window.document; | |
end = +new Date(); | |
console.log( (end - start) + ' ms to load' ); | |
// each take about 10 seconds on my core i5 !? |
This file contains 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 jsdom = require('jsdom@0.2.0') | |
,fs = require('fs') | |
,testHtml = fs.readFileSync(__dirname + '/british_throne.html', 'utf8') | |
,html5 = require('html5') | |
,window | |
,document | |
,start = +new Date() | |
,end; | |
start = +new Date(); | |
window = jsdom.jsdom(testHtml, null, { | |
features: { | |
FetchExternalResources : false, | |
ProcessExternalResources: false, | |
QuerySelector: true, | |
MutationEvents: false | |
} | |
//,parser: html5 | |
}).createWindow(); | |
document = window.document; | |
end = +new Date(); | |
console.log( (end - start) + ' ms to load' ); | |
// takes about 10 seconds |
This file contains 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
#!/bin/bash | |
# I'd put the html into the gist, but it breaks github's servers because it's so large! | |
curl http://en.wikipedia.org/wiki/Line_of_succession_to_the_British_Throne > british_throne.html |
This file contains 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 jsdom = require('jsdom@0.2.0') | |
,fs = require('fs') | |
,testHtml = fs.readFileSync(__dirname + '/british_throne.html', 'utf8') | |
,html5 = require('html5') | |
,window | |
,document | |
,start = +new Date() | |
,end; | |
start = +new Date(); | |
window = jsdom.jsdom(testHtml, null, { | |
features: { | |
FetchExternalResources : false, | |
ProcessExternalResources: false, | |
QuerySelector: true, | |
MutationEvents: false | |
} | |
,parser: html5 | |
}).createWindow(); | |
document = window.document; | |
end = +new Date(); | |
console.log( (end - start) + ' ms to load' ); | |
// takes approximately 70 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment