Commit Graph

33 Commits

Author SHA1 Message Date
thinkerou 1d5b9badd9
chore: rename getQueryCache/getFormCache to initQueryCache/initFormCache (#2375) 2020-05-14 11:35:14 +08:00
Bo-Yi Wu 1bebd9af91
Revert "fix accept incoming network connections (#2216)" (#2294)
This reverts commit 2ff2b19e14.
2020-03-23 17:48:25 +08:00
kebo 2ff2b19e14
fix accept incoming network connections (#2216) 2020-03-07 09:21:02 +08:00
Rafal Zajac e602d524cc Typo (#1971) 2019-07-04 07:57:52 +08:00
田欧 d510595aa5 chore: add some annotations (#1544)
ref: #1075 
because I am not a native English, maybe have a bit problem.
2018-09-15 10:23:32 +08:00
田欧 87d536c001 utils: use strings.Split instead of strings.IndexByte (#1400)
And I test them benchmark:

code:

```go
# stringsbench.go
package stringsbench

import "strings"

func index(part string) string {
	if index := strings.IndexByte(part, ';'); index >= 0 {
		if part := strings.TrimSpace(strings.Split(part, ";")[0]); part != "" {
			return part[0:index]
		}
	}
	return ""
}

func split(part string) string {
	return strings.Split(part, ";")[0]
}
```

```go
# stringsbench_test.go
package stringsbench

import (
	"testing"
)

func BenchmarkIndex(b *testing.B) {
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			index("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
		}
	})
}

func BenchmarkSplit(b *testing.B) {
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			split("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
		}
	})
}
```

And the result:

```shell
➜  strings go test --bench=.
goos: darwin
goarch: amd64
BenchmarkIndex-8   	30000000	        46.1 ns/op
BenchmarkSplit-8   	50000000	        35.9 ns/op
PASS
ok  	_/Users/tianou/strings	3.271s
➜  strings go test --bench=.
goos: darwin
goarch: amd64
BenchmarkIndex-8   	30000000	        44.2 ns/op
BenchmarkSplit-8   	50000000	        34.7 ns/op
PASS
ok  	_/Users/tianou/strings	3.156s
➜  strings go test --bench=.
goos: darwin
goarch: amd64
BenchmarkIndex-8   	30000000	        45.6 ns/op
BenchmarkSplit-8   	50000000	        35.3 ns/op
PASS
ok  	_/Users/tianou/strings	3.230s
```
2018-06-21 09:31:43 +08:00
Yoshiyuki Kinjo 6ad7b9c9d3 Fix documentation typo (#1321) 2018-04-17 10:54:40 +08:00
Weilin Shi 6626358d4f Fix golint warnings in utils.go (#1209) 2017-12-25 13:58:02 +08:00
田欧 3b300929e8 Empty string check (#1101) 2017-09-29 00:22:35 +08:00
田欧 a8fa424ae5 update comment (#1057) 2017-08-16 11:55:50 +08:00
Eason Lin 7eb943e70a Use single line (#985) 2017-07-06 19:43:47 -05:00
Javier Provecho Fernandez 9e930b9bdd lint code 2016-04-15 01:16:46 +02:00
Manu Mtz.-Almeida d64a1fb91c Cosmetic changes 2016-01-28 00:35:09 +01:00
Manu Mtz-Almeida ce2201c392 router.Run() can be called without parameters. #405 2015-08-16 16:19:51 +02:00
Manu Mtz-Almeida 22f118f3b6 Adds gin.Bind() usage panic! 2015-06-13 00:01:02 +02:00
Manu Mtz-Almeida ab447bb188 Adds Bind() middleware 2015-06-12 23:42:54 +02:00
Manu Mtz-Almeida c4914f0ff7 Adds WrapF() and WrapH() 2015-05-20 00:39:52 +02:00
Manu Mtz-Almeida 4f855faef2 Adds helper function. Wrap(http.HandlerFund) gin.HandlerFun 2015-05-19 22:18:58 +02:00
Manu Mtz-Almeida ac1ee3fb86 Adds unit tests for Utils 2015-04-08 15:32:50 +02:00
Manu Mtz-Almeida 8b26264574 Merge branch 'develop' into performance
Conflicts:
	context.go
	context_test.go
	gin_test.go
	recovery_test.go
	utils.go
2015-04-08 13:37:25 +02:00
Manu Mtz-Almeida ac0ad2fed8 Improves unit tests 2015-04-08 02:58:35 +02:00
Manu Mtz-Almeida 1f6304ca25 Cleaning up performance branch 2015-04-07 12:22:38 +02:00
Manu Mtz-Almeida 2915fa0ffe Zero allocation router, first commit 2015-03-31 21:39:06 +02:00
Manu Mtz-Almeida 3e3ced70d4 Using log.Panic instead 2015-03-23 05:50:10 +01:00
Manu Mtz-Almeida 615c62d736 Some cosmetic changes 2015-03-23 04:41:29 +01:00
Manu Mtz-Almeida aa7b00a083 General refactoring. Part 2. 2014-10-09 01:40:42 +02:00
Manu Mtz-Almeida 07a3961941 General refactoring 2014-10-08 21:37:26 +02:00
Manu Mtz-Almeida 275bdc194e Fixes Content.Negotiate API 2014-08-31 18:28:18 +02:00
Manu Mtz-Almeida ffea7e88a2 Working on content type negotiation API 2014-08-30 22:22:57 +02:00
Manu Mtz-Almeida 8e5397bfa0 Adds in-code license 2014-08-29 19:49:50 +02:00
Manu Mtz-Almeida 809eee8a72 Adds debug mode (part 1)
- Adds API to switch the gin's mode
- Log listening port
- Log routes
2014-08-19 03:40:52 +02:00
Manu Mtz-Almeida dda70bf382 Refactors Static() file serving 2014-07-17 02:02:09 +02:00
Manu Mtz-Almeida dc43372610 Splitting source code in different files 2014-07-16 20:14:03 +02:00