http://www.giantflyingsaucer.com/blog/?p=5994
使用JWT的token认证,防止别人知道了接口后,随意调用,但是发现
stepping : 4
microcode : 0x428
cpu MHz : 2600.062
cache size : 20480 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm
bogomips : 5200.12
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
使用 go test -test.bench=".*" -v 命令测试,发现加密的挺耗时间的
goos: linux
goarch: amd64
pkg: github.com/KerryJava/goserver
Benchmark_TimeConsumingOrm 5000 265224 ns/op
Benchmark_TimeConsumingOrm 5000 248941 ns/op
Benchmark_TimeConsumingOrm 10000 245728 ns/op
Benchmark_TimeConsumingOrm 5000 268391 ns/op
Benchmark_TimeConsumingOrm 5000 247001 ns/op
Benchmark_TimeConsumingFunctionRawQuery 10000 215219 ns/op
Benchmark_TimeConsumingFunctionRawQuery 10000 213085 ns/op
Benchmark_TimeConsumingFunctionRawQuery 10000 210200 ns/op
Benchmark_TimeConsumingFunctionRawQuery 10000 209737 ns/op
Benchmark_TimeConsumingFunctionRawQuery 10000 209695 ns/op
Benchmark_TimeConsumingFunctionRawQueryPrepare 20000 65998 ns/op
Benchmark_TimeConsumingFunctionRawQueryPrepare 20000 66214 ns/op
Benchmark_TimeConsumingFunctionRawQueryPrepare 20000 67460 ns/op
Benchmark_TimeConsumingFunctionRawQueryPrepare 20000 67988 ns/op
Benchmark_TimeConsumingFunctionRawQueryPrepare 20000 67424 ns/op
Benchmark_JWTRSA256Sign 300 4128990 ns/op
Benchmark_JWTRSA256Sign 300 4119935 ns/op
Benchmark_JWTRSA256Sign 300 4175446 ns/op
Benchmark_JWTRSA256Sign 300 4121553 ns/op
Benchmark_JWTRSA256Sign 300 4137870 ns/op
Benchmark_JWTRSA256Decode 10000 139202 ns/op
Benchmark_JWTRSA256Decode 10000 138939 ns/op
Benchmark_JWTRSA256Decode 10000 139415 ns/op
Benchmark_JWTRSA256Decode 10000 139179 ns/op
Benchmark_JWTRSA256Decode 10000 137128 ns/op
PASS
ok github.com/KerryJava/goserver 43.983s