vesoft-inc / nebula-importer

Nebula Graph Importer with Go
Apache License 2.0
90 stars 60 forks source link

fix: negative hex #249

Closed veezhang closed 1 year ago

veezhang commented 1 year ago

fix: negative hex

Improve performance of checkVidFormat, the time is reduced by 92.22%.

name              old time/op  new time/op  delta
checkVidFormat-8  1.17µs ± 0%  0.09µs ± 3%  -92.22%  (p=0.000 n=8+10)

Benchmark code:

func Benchmark_checkVidFormat(b *testing.B) {
    for i := 0; i < b.N; i++ {
        _ = checkVidFormat("-0xfedcba9876543210", true)
        _ = checkVidFormat("-076543210", true)
        _ = checkVidFormat("-9876543210", true)
        _ = checkVidFormat("hash(\"abcdefg\")", true)
    }
}

What type of PR is this?

What problem(s) does this PR solve?

Issue(s) number:

247

Description:

How do you solve it?

Special notes for your reviewer, ex. impact of this fix, design document, etc:

yixinglu commented 1 year ago

This PR has been contained in others, so be free to close it.