chore: improve titleCasedName performance #1691

Merged
lunny merged 2 commits from performance into master 2 years ago
appleboy commented 2 years ago
Collaborator
$ 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 2 years ago
1360686907 chore: improve titleCasedName performance
appleboy reviewed 2 years ago
Dismissed
names/mapper.go Outdated
if 'a' <= chr && chr <= 'z' {
chr -= ('a' - 'A')
if 'a' <= c && c <= 'z' {
c += 'a' - 'A'
Poster
Collaborator

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

I will change to `c -= 'a' - 'A'`
appleboy added 1 commit 2 years ago
1637507361 udpate
Poster
Collaborator

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 2 years ago
lunny added the
kind/performance
label 2 years ago
appleboy added this to the 1.1.1 milestone 2 years ago
lunny modified the milestone from 1.1.1 to 1.0.2 1 year ago
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build encountered an error
The pull request has been merged as f071e5eb96.
Sign in to join this conversation.
Loading…
There is no content yet.