From f5c68b280fa45c9a392794364272ddfc711bc7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=B6hm?= Date: Sun, 20 May 2012 22:54:48 +0300 Subject: [PATCH] bench: add url parser benchmark --- benchmark/url.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 benchmark/url.js diff --git a/benchmark/url.js b/benchmark/url.js new file mode 100644 index 00000000000..c35cd959f06 --- /dev/null +++ b/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); + }); +}); \ No newline at end of file