Skip to content
Myr

Perf: memoize parsed urls

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent b739126 · Browse files · 2 files+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−5 removed

  • other:+5 added−5 removed

2 files+5 added−5 removed

modified:lib/router/index.js+3 added-3 removed
9 unmodified lines
1011var Route = require('./route')12 , utils = require('../utils')13 , debug = require('debug')('express:router')14 , parse = require('url').parse;14 , parse = require('connect').utils.parseUrl;1516/**17 * Expose `Router` constructor.18 */
174 unmodified lines
193 * @api private194 */195196Router.prototype._options = function(req, res){197 var path = parse(req.url).pathname197 var path = parse(req).pathname198 , body = this._optionsFor(path).join(',');199 res.set('Allow', body).send(body);200};201
30 unmodified lines
232 */233234Router.prototype.match = function(req, i, head){235 var method = req.method.toLowerCase()236 , url = parse(req.url)236 , url = parse(req)237 , path = url.pathname238 , routes = this.map239 , i = i || 0240 , route;
55 unmodified lines
modified:lib/request.js+2 added-2 removed
10 unmodified lines
1112var http = require('http')13 , utils = require('./utils')14 , connect = require('connect')15 , parse = require('url').parse15 , parse = connect.utils.parseUrl16 , mime = require('mime');1718/**19 * Request prototype.
354 unmodified lines
374 * @api public375 */376377req.__defineGetter__('path', function(){378 return parse(this.url).pathname;378 return parse(this).pathname;379});380381/**382 * Check if the request is fresh, aka
35 unmodified lines