Skip to content
thep1ckaxe91Public

About

My own SSO implementation bench to compare with Clang's for fun (research)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

TP SSO string Benchmark

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.

Prerequisites

  • Docker (or Podman)
  • Make

Getting Started

A Makefile is provided to streamline all common development commands inside the isolated Docker environment.

1. Initialize the Environment

Run this command to build the Docker image, detect your Conan profile, and install all necessary dependencies:

make init

2. Build the Project

To compile the tp::string library, tests, and benchmarks using Clang and libc++:

make build

3. Run Tests

To execute the gtest suite and verify the correctness of the tp::string implementation:

make test

4. Run Benchmarks

To execute the google-benchmark suite and compare the p99 performance of tp::string against std::string on small vs. large strings:

make bench

5. Debugging

To drop into a GDB session inside the container, attached to the test executable:

make debug

6. Interactive Shell

If you need to manually explore the containerized environment:

make shell

Local (Host) Workflow

If 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-init
  • make local-build
  • make local-test
  • make local-bench

Project Structure

  • src/: Contains the tp::string implementation.
  • tests/: Contains the gtest correctness suites.
  • benchmarks/: Contains the google-benchmark suites.
  • 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.

About

My own SSO implementation bench to compare with Clang's for fun (research)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages