Improved performance
This commit is contained in:
parent
559f8c8456
commit
c179ca6651
10
README.md
10
README.md
@ -50,11 +50,11 @@ coverage: 100.0% of statements
|
|||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
||||||
```
|
```
|
||||||
BenchmarkStatic/#00-12 34975490 33.63 ns/op 0 B/op 0 allocs/op
|
BenchmarkStatic/#00-12 36761953 31.12 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkStatic/hello-12 26550235 44.20 ns/op 0 B/op 0 allocs/op
|
BenchmarkStatic/hello-12 28145253 41.21 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkStatic/hello/world-12 20356144 59.08 ns/op 0 B/op 0 allocs/op
|
BenchmarkStatic/hello/world-12 21206058 55.10 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkGitHub/gists/:id-12 21693214 54.80 ns/op 0 B/op 0 allocs/op
|
BenchmarkGitHub/gists/:id-12 21452644 52.65 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkGitHub/repos/:a/:b-12 18118347 65.33 ns/op 0 B/op 0 allocs/op
|
BenchmarkGitHub/repos/:a/:b-12 17888092 61.59 ns/op 0 B/op 0 allocs/op
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
@ -41,10 +41,13 @@ func New() Server {
|
|||||||
config: defaultConfig(),
|
config: defaultConfig(),
|
||||||
handlers: []Handler{
|
handlers: []Handler{
|
||||||
func(c Context) error {
|
func(c Context) error {
|
||||||
handler := c.(*ctx).server.router.LookupNoAlloc(c.Method(), c.Path(), c.(*ctx).addParameter)
|
ctx := c.(*ctx)
|
||||||
|
method := ctx.Method()
|
||||||
|
path := ctx.Path()
|
||||||
|
handler := ctx.server.router.LookupNoAlloc(method, path, ctx.addParameter)
|
||||||
|
|
||||||
if handler == nil {
|
if handler == nil {
|
||||||
return c.Status(http.StatusNotFound).String(http.StatusText(http.StatusNotFound))
|
return ctx.Status(http.StatusNotFound).String(http.StatusText(http.StatusNotFound))
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler(c)
|
return handler(c)
|
||||||
|
Loading…
Reference in New Issue
Block a user