About this project

dash-em is a string manipulation library designed with a singular, unwavering, and intentionally absurd purpose: removing em-dashes (U+2014) from UTF-8 encoded text. The project describes itself as "enterprise-grade" and "production-ready," but explicitly discloses that it is a tongue-in-cheek exploration of over-engineering. Despite the meme status, the codebase is written with genuine engineering rigor, leveraging advanced CPU vectorization techniques to achieve performance characteristics that are deeply unnecessary for the task at hand. The core of dash-em is a pure C implementation with zero external dependencies. It automatically detects the host CPU's capabilities and dispatches to the most optimized SIMD instruction set available. Supported paths include AVX-512F (64 bytes per iteration), AVX2 (32 bytes), SSE4.2 (16 bytes), and ARM NEON (16 bytes), with a scalar fallback for older hardware. The library includes micro-optimizations such as loop unrolling, cache prefetching, bitmask matching, and fast paths for small strings to minimize overhead. Performance benchmarks are provided across multiple architectures (Linux, Windows, macOS on Intel and Apple Silicon). The core C library demonstrates throughput speeds ranging from 1.27 GB/s to over 42 GB/s, depending on the density of em-dashes in the input and the specific CPU architecture. Language bindings show significant speedups over native byte-level iteration in their respective ecosystems; for example, Python bindings are reported to be up to 766x faster than pure Python byte manipulation, while JavaScript bindings offer up to 40x speedups over Buffer manipulation. The project supports an extensive array of language bindings, including JavaScript/TypeScript (Node.js), Python, Go, Rust, Java, C#/.NET, PHP, Ruby, Swift, Kotlin, R, Dart, Scala, Perl, Lua, Haskell, Elixir, Zig, and Objective-C. Additionally, it compiles to WebAssembly (wasm32 and WASI) for browser and serverless environments. The API is straightforward, typically exposing a `remove()` function that takes a string or buffer and returns the cleaned output. JavaScript bindings also offer `removeBuffer()` and `removeBufferInPlace()` for zero-copy or in-place operations, respectively. Installation is provided via standard package managers for most languages (e.g., `npm install dash-em`, `pip install dash-em`) or via CMake for the core C library. The project includes comprehensive test suites and continuous integration pipelines that verify correctness and performance across all supported platforms and bindings. While the utility of such a specialized library is questionable, it serves as a demonstration of SIMD optimization techniques and cross-language binding architecture in a highly entertaining context.