summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Böhm <felixboehm55@googlemail.com>2012-05-20 22:54:48 +0300
committerBen Noordhuis <info@bnoordhuis.nl>2012-09-13 01:21:53 +0200
commitf5c68b280fa45c9a392794364272ddfc711bc7a0 (patch)
treefa6c45670f5b04e42995868f30272b98b0f6b68d
parentbb207c2827cd758dd273adb28badeb9ec2586939 (diff)
downloadnode-f5c68b280fa45c9a392794364272ddfc711bc7a0.tar.gz
bench: add url parser benchmark
-rw-r--r--benchmark/url.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/benchmark/url.js b/benchmark/url.js
new file mode 100644
index 000000000..c35cd959f
--- /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