-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
by qinhui99:
I found a very bad performance for strconv of Go. I did some tests between Go and JAVA for string function. You can see the test results, Go has a very bad performance comparing JAVA. The strconv function is very bad performance and needed to do some refactoring. Since the strconv function is very important basic stone of Go , so I need your help. Thanks 1. float32 to string Go version: (GO 1.0.1, winxp) go test ftoa_test.go -bench="." BenchmarkFloat32ToStr 100000 12812 ns/op ok command-line-arguments 1.938s Java version: (JDK1.7 ,winxp , use the "-server" jvm parameter) Loop 10000000 times Time costs 2.45952435 (s). performance:2459 ns/op 2. int32 to string Go version: (GO 1.0.1, winxp) go test itoa_test.go -bench="." BenchmarkFormatIntByQH 500000 2843 ns/op ok command-line-arguments 1.797s Java version: (JDK1.7 ,winxp , use the "-server" jvm parameter) Loop 10000000 times Time costs 0.695598031 (s). performance:695 ns/op 3. float64 to string Go version: go test ftoa_test.go -bench="." BenchmarkFloat32ToStr 200000 13046 ns/op BenchmarkFloat64ToStr 100000 22656 ns/op ok command-line-arguments 5.594s JAVA version:(JDK1.7 ,winxp , use the "-server" jvm parameter) Loop 10000000 times Time costs 5.079030794 (s). performance:5079 ns/op
Attachments:
- itoa_test.go (1375 bytes)
- ftoa_test.go (1882 bytes)
- AtoStringBenchmarkTest.java (613 bytes)
- DoubleToStringBenchmarkTest.java (664 bytes)
- FloatToStringBenchmarkTest.java (666 bytes)
- BenchmarkTest.java (523 bytes)
- B.java (74 bytes)
Reactions are currently unavailable