Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
bench: add url parser benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 authored and bnoordhuis committed Sep 12, 2012
1 parent bb207c2 commit f5c68b2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions benchmark/url.js
@@ -0,0 +1,22 @@
var url = require('url'),
urls = [
'http://nodejs.org/docs/latest/api/url.html#url_url_format_urlobj',
'http://blog.nodejs.org/',
'https://encrypted.google.com/search?q=url&q=site:npmjs.org&hl=en',
'javascript:alert("node is awesome");',
'some.ran/dom/url.thing?oh=yes#whoo'
],
paths = [
'../foo/bar?baz=boom',
'foo/bar',
'http://nodejs.org',
'./foo/bar?baz'
];

urls.forEach(url.parse);
urls.forEach(url.format);
urls.forEach(function(u){
paths.forEach(function(p){
url.resolve(u, p);
});
});

0 comments on commit f5c68b2

Please sign in to comment.