-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
urlapi: leaner with fewer allocs #9408
Conversation
4d2ad70
to
c03305e
Compare
Stats on 2022-09-02Running the test program on the same machine this PR vs master, Speed testRunning the test code with 10000 loops.
The PR seems to be ~5% faster in this test. Memory use(Given the test program 10 loops to run)
|
Two commits laterRunning the test program on the same machine this PR vs master, Speed testRunning the test code with 10000 loops.
The PR completes at roughly 97.8% of the old time. Memory use(Given the test program 10 loops to run, 16640 URLs)
Note:This is a debug build on an old machine. It is likely to run much faster in other conditions. |
Slightly faster with more robust code. Uses fewer and smaller mallocs. - remove two fields from the URL handle struct - reduce copies and allocs - use dynbuf buffers more instead of custom malloc + copies - uses dynbuf to build the host name in reduces serial alloc+free within the same function. Closes #9408
42829e3
to
8741dc9
Compare
Slightly faster with more robust code. Uses fewer and smaller mallocs. - remove two fields from the URL handle struct - reduce copies and allocs - use dynbuf buffers more instead of custom malloc + copies - uses dynbuf to build the host name in reduces serial alloc+free within the same function. - move dedotdotify into urlapi.c and make it static, and not strdup the input Closes #9408
8741dc9
to
98d4f29
Compare
Stats on 2022-09-04Running the test program on the same machine this PR vs master, Speed testRunning the test code with 10000 loops.
The PR completes at roughly 93.4% of the old time. Memory use(Given the test program 10 loops to run)
|
The same PR and commit version in a non-debug build times like this:
|
I ran
|
Slightly faster with more robust code. Uses fewer and smaller mallocs. - remove two fields from the URL handle struct - reduce copies and allocs - use dynbuf buffers more instead of custom malloc + copies - uses dynbuf to build the host name in reduces serial alloc+free within the same function. - move dedotdotify into urlapi.c and make it static, and not strdup the input Closes #9408
98d4f29
to
f6fd68d
Compare
Stats on 2022-09-05Running the test program on the same machine this PR vs master, Speed testRunning the test code with 10000 loops.
The PR completes at roughly 90.1% of the old time. Memory use(Given the test program 10 loops to run)
|
The ctype change is not a urlapi change at all, so I will split that out as a separate PR. Some of the performance gain in the last update may be attributed to that ctype PR. |
f6fd68d
to
f07470d
Compare
Slightly faster with more robust code. Uses fewer and smaller mallocs. - remove two fields from the URL handle struct - reduce copies and allocs - use dynbuf buffers more instead of custom malloc + copies - uses dynbuf to build the host name in reduces serial alloc+free within the same function. - move dedotdotify into urlapi.c and make it static, and not strdup the input Closes #9408
f07470d
to
16d4bdc
Compare
Slightly faster with more robust code. Uses fewer and smaller mallocs. - remove two fields from the URL handle struct - reduce copies and allocs - use dynbuf buffers more instead of custom malloc + copies - uses dynbuf to build the host name in reduces serial alloc+free within the same function. - move dedotdotify into urlapi.c and make it static, and not strdup the input - remove a few strlen() calls - add Curl_dyn_setlen() that can "trim" an existing dynbuf Closes #9408
16d4bdc
to
6d0b88a
Compare
An optimized non-debug build on the same host and we are below half a microsecond on average:
|
Slightly faster with more robust code. Uses fewer and smaller mallocs. - remove two fields from the URL handle struct - reduce copies and allocs - use dynbuf buffers more instead of custom malloc + copies - uses dynbuf to build the host name in reduces serial alloc+free within the same function. - move dedotdotify into urlapi.c and make it static, not strdup the input and optimize it by checking for . and / before using strncmp - remove a few strlen() calls - add Curl_dyn_setlen() that can "trim" an existing dynbuf Closes #9408
6d0b88a
to
aaf5d25
Compare
On my mac mini, the current PR improves things from
to
|
urlapi: leaner with fewer allocs
Slightly faster with more robust code. Uses fewer and smaller mallocs.
This is my test program: speedparse.c