cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Please advise on how to improve libcurl HTTP GET performance

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Mon, 10 Oct 2011 23:07:47 +0100

Hi Alex,

> 2) I didn't try telnet, but both Opera and console CURL tool
> download the very same page at ~300 KB/s, which is much closer
> to my actual net speed. Just a reminder: libcurl gives me 25-40 KB/s.

It is worth noting that CURL uses libcurl internally so I would expect the
same performance...

> Here's the code, you can see what page I'm testing on. CByteArray
> is just a wrapper for void* buffer, it's append uses realloc and memcpy.

It looks pretty much okay to me - although I did wonder a couple of things:

1) What is your page.byteArray() function returning? Is it the void* that
CByteArray wraps or is it a reference? If it's the void* then surely the
ampersand isn't required is it? If this is the case then are you passing the
address of your void* (so effectively a void**) and not the contents of your
void* which may be causing the runtime library / OS's memory manager to do
"extra" stuff (thus slowing you down) if you're overwriting memory
boundaries etc...

2) What does your append() do? You mentioned realloc() and memcpy() - does
it do anything else? What happens if you use a pre-allocated chunk of memory
rather than keep allocating it (Obviously you wouldn't want you app to run
like this but just as a test to see if it's the append() that is slowing
things down).

Kind Regards

Steve

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-11