This repository serves as an experimental C++20 environment to research, theorize, implement, debug, and benchmark a custom 24-byte Small String Optimization (SSO) string class (tp::string). Its primary purpose is to compare performance against the state-of-the-art libc++ (std::string) SSO implementation from Clang.
The workflow is designed to be fully containerized using Docker, removing the friction of setting up local toolchains (Clang 18, libc++, Conan, Google Test, Google Benchmark, CMake) so you can focus entirely on development and iterative performance testing.
- Docker (or Podman)
- Make
A Makefile is provided to streamline all common development commands inside the isolated Docker environment.
Run this command to build the Docker image, detect your Conan profile, and install all necessary dependencies:
make initTo compile the tp::string library, tests, and benchmarks using Clang and libc++:
make buildTo execute the gtest suite and verify the correctness of the tp::string implementation:
make testTo execute the google-benchmark suite and compare the p99 performance of tp::string against std::string on small vs. large strings:
make benchTo drop into a GDB session inside the container, attached to the test executable:
make debugIf you need to manually explore the containerized environment:
make shellIf you prefer to run the toolchain directly on your host machine (assuming you have Clang, libc++, Conan, and CMake installed locally), you can use the local-* targets:
make local-initmake local-buildmake local-testmake local-bench
src/: Contains thetp::stringimplementation.tests/: Contains thegtestcorrectness suites.benchmarks/: Contains thegoogle-benchmarksuites.Dockerfile: The Ubuntu 24.04 environment configured with Clang and Conan.Makefile: Entrypoints for all Docker and local commands.CMakeLists.txt&conanfile.txt: Build and dependency management.