Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not satisfied with the benchmark result #3

Closed
xtaci opened this issue Oct 9, 2017 · 6 comments
Closed

not satisfied with the benchmark result #3

xtaci opened this issue Oct 9, 2017 · 6 comments

Comments

@xtaci
Copy link
Contributor

xtaci commented Oct 9, 2017

$ go test -run=^$ -bench  .
beginning tests, encryption:salsa20, fec:10/3
goos: darwin
goarch: amd64
pkg: github.com/xtaci/kcp-go
BenchmarkSM4-4             	   20000	     92234 ns/op	  32.53 MB/s	    6016 B/op	     376 allocs/op
BenchmarkAES128-4          	  200000	      7268 ns/op	 412.74 MB/s	       0 B/op	       0 allocs/op
BenchmarkAES192-4          	  200000	      8190 ns/op	 366.28 MB/s	       0 B/op	       0 allocs/op
BenchmarkAES256-4          	  200000	      9055 ns/op	 331.30 MB/s	       0 B/op	       0 allocs/op
BenchmarkTEA-4             	  100000	     19463 ns/op	 154.13 MB/s	       0 B/op	       0 allocs/op
BenchmarkXOR-4             	20000000	       108 ns/op	27679.97 MB/s	       0 B/op	       0 allocs/op
BenchmarkBlowfish-4        	   50000	     34005 ns/op	  88.22 MB/s	       0 B/op	       0 allocs/op
BenchmarkNone-4            	30000000	        56.5 ns/op	53066.58 MB/s	       0 B/op	       0 allocs/op
BenchmarkCast5-4           	   30000	     41978 ns/op	  71.47 MB/s	       0 B/op	       0 allocs/op
Benchmark3DES-4            	   10000	    149801 ns/op	  20.03 MB/s	       0 B/op	       0 allocs/op
BenchmarkTwofish-4         	   30000	     48963 ns/op	  61.27 MB/s	       0 B/op	       0 allocs/op
BenchmarkXTEA-4            	   30000	     59826 ns/op	  50.15 MB/s	       0 B/op	       0 allocs/op
BenchmarkSalsa20-4         	  500000	      4010 ns/op	 748.07 MB/s	       0 B/op	       0 allocs/op

SM4 is slow compared to other block ciphers, and it has many memory allocations when crypting.

am I misused this library or may be any improvements can be taken?

@xtaci xtaci changed the title not satisfied with benchmark result not satisfied with the benchmark result Oct 9, 2017
@tjfoc
Copy link
Owner

tjfoc commented Oct 10, 2017

thanks.

similar to DES, SM4 is slow compared with other block ciphers, especially AES.

Will keep this issue open and take some time to optimize this. And pull requests are welcome.

@QwertyJack
Copy link
Contributor

Speed up approx 70 %.
See #11 .

@tjfoc
Copy link
Owner

tjfoc commented Oct 24, 2017

#11 merged. thanks

@xtaci
Copy link
Contributor Author

xtaci commented Oct 24, 2017

the speed is comparable to twofish now. 4x faster than 3des.

@xtaci
Copy link
Contributor Author

xtaci commented Oct 24, 2017

the next step is to add support for _amd64.s , optimize the core computation with assembly.

@tjfoc
Copy link
Owner

tjfoc commented Nov 24, 2017

performance improved in 1.1.0

@tjfoc tjfoc closed this as completed Nov 24, 2017
czdsdo pushed a commit that referenced this issue Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants