Serd is a lightweight C library for RDF syntax which supports reading
and writing Turtle, TRiG, NTriples, and NQuads.
Serd is suitable for performance-critical or resource-limited applications, such as serialising very large data sets, network protocols, or embedded systems that require minimal dependencies and lightweight deployment.

Features

Portable and Dependency Free: Serd has no external dependencies other
than the C standard library. It is known to compile with GCC, Clang, and
MSVC (as C++), and is tested on GNU/Linux, several BSD variants, Mac OS X,
and Windows.

Small: Serd is implemented in few thousand lines of standard C code. It
typically compiles to about 100 KiB, or about 50 KiB stripped with size
optimizations.

Fast and Lightweight: Serd can stream abbreviated Turtle, unlike many
tools which must first build an internal model. This makes it particularly
useful for writing very large data sets, since it can do so using only a
small amount of memory. Serd is, to the author's knowledge, the fastest
Turtle reader/writer by a wide margin (see Performance
below).

Conformant and Well-Tested: Serd passes all tests in the Turtle and TRiG
test suites, correctly handles all "normal" examples in the URI
specification, and includes many additional tests which were written
manually or discovered with fuzz testing. The test suite has 100% code
coverage by line, and runs with zero memory errors or leaks.

Performance

The benchmarks below compare serdi, rapper, and riot re-serialising Turtle data generated by sp2b on an i7-4980HQ running Debian 9. Of the three, serdi is the fastest by a wide margin, and the only one that uses a constant amount of memory (a single page) for all input sizes.