Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Faster unsafe pointers #542

Merged
merged 1 commit into from
Jan 5, 2016
Merged

Faster unsafe pointers #542

merged 1 commit into from
Jan 5, 2016

Conversation

Anderman
Copy link
Contributor

See issue

@dnfclas
Copy link

dnfclas commented Dec 29, 2015

Hi @Anderman, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@cesarblum
Copy link
Contributor

Did you benchmark this change?

@Anderman
Copy link
Contributor Author

Yes, The Peeklong is 20% faster with this optimization. But the overal improvement will be small, with this simple change.

if ({header.EqualIgnoreCaseBytes()})
{{
if ({header.TestBit()})
fixed (byte* ptr = &keyBytes[keyOffset])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the line above (and var pUB = ptr;), are the rest of the changes in this method just formatting?

@Anderman
Copy link
Contributor Author

Yes that's correct. Now if I use CTRL K+D in the generated file the layout stays does not change anymore

@halter73
Copy link
Member

halter73 commented Jan 5, 2016

Ran these changes against our plaintext benchmark just to see. The numbers are close enough that I can't rule out variance for sure, but it's definitely possible this simple change made a difference.

anderman/faster-unsafe:

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.72ms    9.79ms 304.21ms   95.43%
    Req/Sec    34.61k     1.78k   53.72k    82.64%
  11111035 requests in 10.10s, 1.37GB read
Requests/sec: 1100263.92
Transfer/sec:    138.51MB


Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.84ms   15.18ms 311.85ms   92.55%
    Req/Sec    34.56k     2.29k   56.27k    86.30%
  11075082 requests in 10.10s, 1.36GB read
Requests/sec: 1096589.13
Transfer/sec:    138.04MB

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.13ms   12.61ms 273.69ms   96.51%
    Req/Sec    34.58k     2.10k   63.53k    83.15%
  11088321 requests in 10.10s, 1.36GB read
Requests/sec: 1097900.31
Transfer/sec:    138.21MB

dev:

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.42ms   14.98ms 306.17ms   96.48%
    Req/Sec    34.35k     2.75k   79.63k    90.64%
  10997767 requests in 10.10s, 1.35GB read
Requests/sec: 1088962.43
Transfer/sec:    137.08MB

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.67ms   10.11ms 277.82ms   94.88%
    Req/Sec    34.54k     2.00k   56.89k    84.21%
  11078804 requests in 10.10s, 1.36GB read
Requests/sec: 1096965.81
Transfer/sec:    138.09MB

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.25ms    6.98ms 291.27ms   95.66%
    Req/Sec    34.42k     1.96k   57.08k    86.34%
  11033897 requests in 10.10s, 1.36GB read
Requests/sec: 1092491.01
Transfer/sec:    137.53MB

@halter73 halter73 merged commit 8fdfef4 into aspnet:dev Jan 5, 2016
@halter73
Copy link
Member

halter73 commented Jan 5, 2016

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants