Skip to content

Conversation

vmihailenco
Copy link
Collaborator

Benchmark

benchmark                       old ns/op     new ns/op     delta
BenchmarkRedisSetGet64Bytes     103732        100645        -2.98%
BenchmarkRedisSetGet1KB         104926        101539        -3.23%
BenchmarkRedisSetGet10KB        107164        102861        -4.02%
BenchmarkRedisSetGet1MB         5206102       3871532       -25.63%

benchmark                       old allocs     new allocs     delta
BenchmarkRedisSetGet64Bytes     16             15             -6.25%
BenchmarkRedisSetGet1KB         16             15             -6.25%
BenchmarkRedisSetGet10KB        16             15             -6.25%
BenchmarkRedisSetGet1MB         17             16             -5.88%

benchmark                       old bytes     new bytes     delta
BenchmarkRedisSetGet64Bytes     720           656           -8.89%
BenchmarkRedisSetGet1KB         3664          2640          -27.95%
BenchmarkRedisSetGet10KB        3664          2640          -27.95%
BenchmarkRedisSetGet1MB         4211153       3162576       -24.90%

@dim?

@dim
Copy link
Contributor

dim commented Jul 20, 2015

Two things I am not sure about. One is GC: if you create an unsafe reference to a byte slice and that byte slice is garbage collected, what then? Just a thought, may not be relevant.

Also, would like to see a GET/SET benchmark with a relatively large value, eg a few MBs.

@vmihailenco
Copy link
Collaborator Author

I believe GC correctly handles unsafe.Pointer.

Will add more benchmarks.

@vmihailenco
Copy link
Collaborator Author

Updated benchmarks. See first message.

@dim
Copy link
Contributor

dim commented Jul 24, 2015

LGTM

vmihailenco added a commit that referenced this pull request Jul 25, 2015
Use unsafe for bytes->string conversion.
@vmihailenco vmihailenco merged commit fc28d0f into master Jul 25, 2015
@vmihailenco vmihailenco deleted the fix/unsafe-conv branch July 25, 2015 06:29
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

Successfully merging this pull request may close these issues.

2 participants