Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bench: add url parser benchmark

  • Loading branch information...
commit f5c68b280fa45c9a392794364272ddfc711bc7a0 1 parent bb207c2
Felix Böhm fb55 authored bnoordhuis committed
Showing with 22 additions and 0 deletions.
  1. +22 −0 benchmark/url.js
22 benchmark/url.js
View
@@ -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);
+ });
+});
Please sign in to comment.
Something went wrong with that request. Please try again.