add .query memoization for ultimate hello world benchmarks
This commit is contained in:
parent
933ecd8747
commit
261acbde88
3 changed files with 5 additions and 4 deletions
|
@ -11,7 +11,6 @@ console.log(' %s middleware', n);
|
|||
while (n--) {
|
||||
app.use(function(next){
|
||||
return function *(){
|
||||
var p = this.path;
|
||||
yield next;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ pid=$!
|
|||
|
||||
sleep 2
|
||||
|
||||
wrk http://localhost:3000/ \
|
||||
wrk 'http://localhost:3000/?foo[bar]=baz' \
|
||||
-r 2000 \
|
||||
-c 50 \
|
||||
-t 4 \
|
||||
|
|
|
@ -142,7 +142,7 @@ module.exports = {
|
|||
*/
|
||||
|
||||
get path() {
|
||||
var c = this._pc = this._pc || {};
|
||||
var c = this._pathcache = this._pathcache || {};
|
||||
return c[this.url] || (c[this.url] = parse(this.url).pathname);
|
||||
},
|
||||
|
||||
|
@ -169,7 +169,9 @@ module.exports = {
|
|||
get query() {
|
||||
var str = this.querystring;
|
||||
if (!str) return {};
|
||||
return qs.parse(str);
|
||||
|
||||
var c = this._querycache = this._querycache || {};
|
||||
return c[str] || (c[str] = qs.parse(str));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue