Skip to content
Myr

Increase performance by preventing several calls to toLowerCase() in Router#match()

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

Roughly 10% increase for routing speeds

authored by visionmedia · committed by visionmedia · parent 399e0d9 · Browse files · 2 files+9 added−8 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+9 added−8 removed

  • other:+9 added−8 removed

2 files+9 added−8 removed

modified:examples/chat/app.js+7 added-7 removed
modified:lib/express/core.js+2 added-1 removed
93 unmodified lines
94 */95 96 constructor: function(request) {97 this.request = request98 this.method = request.method.lowercase99 },100 101 /**102 * Evaluate the matched route against #request.
44 unmodified lines
147 * @api private148 */149150 match: function(route) {150 if (this.request.method.toLowerCase() === route.method)151 if (this.method === route.method)152 if (this.request.captures = this.request.url.pathname.match(route.path)) {153 this.mapParams(route)154 return true155 }
180 unmodified lines