Tech News
← Back to articles

Antirez/sds: Simple Dynamic Strings library for C

read original related products more articles

Simple Dynamic Strings

Notes about version 2: this is an updated version of SDS in an attempt to finally unify Redis, Disque, Hiredis, and the stand alone SDS versions. This version is NOT binary compatible* with SDS verison 1, but the API is 99% compatible so switching to the new lib should be trivial.

Note that this version of SDS may be a slower with certain workloads, but uses less memory compared to V1 since header size is dynamic and depends to the string to alloc.

Moreover it includes a few more API functions, notably sdscatfmt which is a faster version of sdscatprintf that can be used for the simpler cases in order to avoid the libc printf family functions performance penalty.

How SDS strings work

SDS is a string library for C designed to augment the limited libc string handling functionalities by adding heap allocated strings that are:

Simpler to use.

Binary safe.

Computationally more efficient.

But yet... Compatible with normal C string functions.

... continue reading