17 points · by konceptz · 12y ago · 27 comments
I would be very hesitant to be giving this kind of advice until i had an answer to that.
Would be nice if OP profiled his new code vs. his old code, though I'm guessing libcurl isn't the issue even without seeing profiling results
-Incomparable harnesses
-Misuse of the library's api
-Build switches
-UA sniffing
-Not measuring or controlling for system/net load
This isn't a post about why you shouldn't use libcurl; it's a post about why you shouldn't benchmark your way to blind conclusions.
You're right about the conclusion, I'll reword the title.
As far as why, my calls are certainly in the post somewhat buried in the github code linked to directly on the post.
Certainly more attention should be paid to how testing was done, I'll update that later tonight.
Do you know where I might find some documentation on this?
> I still haven't answered a very important question. Why is libcUrl so much slower?
I'd assume it's likely a result of misuse of libcUrl, or cUrl properly implementing some part of the spec that this hand-rolled implementation ignores.
On top of this, the author's C code isn't very well written. There's use of `sprintf` without arithmetic bounds checks (really he should use `snprintf`), unnecessary construction of a one-character array (that's what a dereference is for), inconsistent whitespace, `malloc` when a stack allocation would make more sense, use of `unsigned char` instead of `char` for strings, etc.
From what I can tell, the libcUrl guys are serious about performance, and I have trouble believing such a wild allegation without any further analysis.
Author again. I have my code in the post, it would be helpful for me to see what mistakes I've made in libcUrl utilization.
Did the OP even test with ruby/python/wget/curl ? Could be a DNS issue and nothing to do with libcurl.
Why spend all that time and not run `gprof` ?!
Showing curl and wget from the command would have been highly beneficial. Would you not have tested that before writing an HTTP client in C?