1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:04:42 -07:00

dwarf: improve the efficiency of string comparison

The existing implementation uses strings.ToLower() on 2
strings before comparing them, which is slower than
strings.EqualFold() in all cases.
This commit is contained in:
Vivek V 2019-10-24 14:49:14 +05:30
parent 722b0e32ba
commit dc51b9b425

View File

@ -806,7 +806,7 @@ func pathJoin(dirname, filename string) string {
// DOS-style path.
drive2, filename := splitDrive(filename)
if drive2 != "" {
if strings.ToLower(drive) != strings.ToLower(drive2) {
if !strings.EqualFold(drive, drive2) {
// Different drives. There's not much we can
// do here, so just ignore the directory.
return drive2 + filename