File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,27 @@ communicated via phone.
115115
116116
117117
118+ # Philosophy and trade-offs
119+
120+ cppcodec aims to support a range of codecs using a shared template-based implementation.
121+ The focus is on a high-quality API that encourages correct use, includes error handling,
122+ and is easy to adopt into other codebases. As a header-only library, cppcodec can
123+ ship implementations of several codecs and variants while only compiling the ones
124+ that you actually use.
125+
126+ Good performance is a goal, but not the topmost priority. In theory, templates allows
127+ to write generic code that is optimized for each specialization individually; however,
128+ in practice compilers still struggle to produce code that's as simple as a
129+ hand-written specialized function. On release builds, depending on the C++ compiler,
130+ cppcodec runs in between (approx.) 100% and 300% of time compared to "regular" optimized
131+ base64 implementations. Both are beat by highly optimized implementations that use
132+ vector instructions (such as [ this] ( https://github.com/aklomp/base64 ) ) or buy better
133+ performance with larger pre-computed tables (such as Chrome's base64 implementation).
134+ Debug builds of cppcodec are slower by an order of magnitude due to the use of templates
135+ and abstractions; make sure you use release or minimum-size builds in production.
136+
137+
138+
118139# API
119140
120141All codecs expose the same API. In the below documentation, replace ` <codec> ` with a
You can’t perform that action at this time.
0 commit comments