Use _MSC_VER (instead of _WIN32) for things that are specific for
Visual Studio.
Also remove #include <winsock2.h> from hiredis.h, as it leaks too
many symbols and defines into the global namespace, which is
undesirable for a public interface header. Anyone who uses the
the affected parts of the hiredis API needs to include the
appropriate headers anyway in order to declare struct timeval
variables.
OK, perhaps the second time is a charm. I forgot that I had
hiredis forked from a long time ago, so the initial pull
request was hosed. :)
* Pulled in sdscatfmt() from Redis, and modified it to accept a
size_t (%T) style format specifier.
* Pulled in sdsll2str() and sdsull2str() from Redis (needed by
sdscatfmt).
* Added a new method, redisFormatSdsCommandArgv() which takes
and sds* as the target, rather than char* (and uses sdscatfmt
instead of sprintf for the construction).
I get roughly the following improvement:
Old: 1.044806
New: 0.481620
The benchmark code itself can be found here:
https://gist.github.com/michael-grunder/c92ef31bb632b3d0ad81Closes#260
SDS is now broken out of Redis into its own project, so include
the latest version from the SDS repo.
This is a backport of the Redis commit doing the same to the bundled hiredis:
320fa02b9b