eggjs / egg-security

Security plugin for egg, force performance too.
MIT License
238 stars 43 forks source link

fix: lower case header will get better performance #3

Closed fengmk2 closed 8 years ago

fengmk2 commented 8 years ago

Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.

https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

mention-bot commented 8 years ago

@fengmk2, thanks for your PR! By analyzing the annotation information on this pull request, we identified @dead-horse to be a potential reviewer

codecov-io commented 8 years ago

Current coverage is 96.29% (diff: 100%)

Merging #3 into master will decrease coverage by 0.01%

@@             master         #3   diff @@
==========================================
  Files            28         28          
  Lines           461        459     -2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits            444        442     -2   
  Misses           17         17          
  Partials          0          0          

Powered by Codecov. Last update 4a46046...6f9ea95

fengmk2 commented 8 years ago

我再提交一个性能对比

fengmk2 commented 8 years ago

10x 性能提升..

setHeader() Benchmark
  node version: v6.4.0, date: Tue Aug 30 2016 10:53:16 GMT+0800 (CST)
  Starting...
  4 tests completed.

  set()                                      x    433,595 ops/sec ±5.37% (79 runs sampled)
  set() with lower case name                 x  3,895,403 ops/sec ±1.61% (86 runs sampled)
  setWithoutLowerCase()                      x 10,567,733 ops/sec ±1.69% (86 runs sampled)
  setWithoutLowerCase() with lower case name x 10,217,612 ops/sec ±1.22% (87 runs sampled)