chore: improve titleCasedName performance #1691

Merged
lunny merged 2 commits from performance into master 2020-05-23 02:24:10 +00:00
Member
$ go test -bench="TitleCasedName" ./names/...
goos: darwin
goarch: amd64
pkg: xorm.io/xorm/names
BenchmarkTitleCasedNameOld-4      376286              3272 ns/op            2248 B/op          9 allocs/op
BenchmarkTitleCasedNameNew-4     1567888               763 ns/op             224 B/op          1 allocs/op
PASS
ok      xorm.io/xorm/names      5.394s

Signed-off-by: Bo-Yi Wu appleboy.tw@gmail.com

``` $ go test -bench="TitleCasedName" ./names/... goos: darwin goarch: amd64 pkg: xorm.io/xorm/names BenchmarkTitleCasedNameOld-4 376286 3272 ns/op 2248 B/op 9 allocs/op BenchmarkTitleCasedNameNew-4 1567888 763 ns/op 224 B/op 1 allocs/op PASS ok xorm.io/xorm/names 5.394s ``` Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
appleboy added 1 commit 2020-05-22 04:53:19 +00:00
chore: improve titleCasedName performance
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
1360686907
appleboy reviewed 2020-05-22 07:29:21 +00:00
Dismissed
names/mapper.go Outdated
@ -115,2 +116,2 @@
if 'a' <= chr && chr <= 'z' {
chr -= ('a' - 'A')
if 'a' <= c && c <= 'z' {
c += 'a' - 'A'
Author
Member

I will change to c -= 'a' - 'A'

I will change to `c -= 'a' - 'A'`
appleboy added 1 commit 2020-05-22 07:30:13 +00:00
udpate
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build encountered an error
1637507361
Author
Member

something wrong with goproxy in China. https://drone.gitea.com/xorm/xorm/1081/1/12

something wrong with goproxy in China. https://drone.gitea.com/xorm/xorm/1081/1/12
lunny merged commit f071e5eb96 into master 2020-05-23 02:22:15 +00:00
lunny added the
kind
performance
label 2020-05-23 02:22:31 +00:00
appleboy added this to the 1.1.1 milestone 2020-05-23 17:12:19 +00:00
lunny modified the milestone from 1.1.1 to 1.0.2 2020-06-13 03:14:56 +00:00
Sign in to join this conversation.
No description provided.