---
SIMDString for Computer Graphics in C - Zander Majercik and Morgan McGuire - CppCon 2022
Video games and other real-time 3D graphics use a surprising number of C text strings, and need them to be fast. For example, strings are tags for language localization, UI elements, variable names for binding to GPU shaders and CPU interpreted scripts, and snippets for runtime code generation in those languages.
Our open source SIMDString class is a drop-in replacement for std::string optimized for graphics applications, which tend to perform a lot of copy construction and concatenation on relatively small strings. SIMDString was originally created for x86 and x64 desktop in the G3D Innovation Engine and later generalized for ARM edge and mobile at NVIDIA and Roblox. Versions have been in production use for a decade now.
SIMDString embeds short strings in the class to reduce heap allocation, intentionally aliases immutable const-segment strings, uses a freelist optimized allocator, leverages SIMD instructions, and has several micro-optimizations for good performance on all platforms. It is >5x faster than std::string and outperforms the previous optimized strings released by Facebook and Electronic Arts on which it builds.
In this talk we introduce SIMDString with a detailed case study of its performance when working with GPU shaders. We review the various optimizations one could use for strings and show why the ones employed in SIMDString are a good combination for graphics–as well as why some seemingly good ideas are actually inefficient in this application. We conclude with benchmark results for multiple string classes showing the tradeoffs between implementations.
---
Zander Majercik
Zander Majercik is a Research Scientist at NVIDIA. His main research interest is novel rendering algorithms with a focus on ray-tracing. He has also worked on projects in vision science, novel display technologies for XR systems, and deep learning algorithms. He graduated from Williams College with a BA in Computer Science.
---
Morgan McGuire
Morgan McGuire is the Chief Scientist at Roblox, channeling and accelerating innovation across the company to build a creative, safe, civil, and scalable Metaverse. Roblox combines social interaction with a dynamic 3D environment and economy, with research impact spanning both technology and social sciences.
Morgan is also known for previous work as a professor, game developer, and industry researcher. As Director of Hyperscale Graphics Research at NVIDIA, Morgan accelerated cloud graphics, esports, ray tracing, and augmented and virtual reality. Morgan’s product work includes the NVIDIA RTXGI and Reflex SDKs and RTX GPUs; the Skylanders®, Call of Duty®, Marvel Ultimate Alliance®, and Titan Quest® series of video games series; the Unity game engine; the E Ink display used in the Amazon Kindle®; and the PeakStream high performance computing architecture acquired by Google. Morgan’s scientific publications and patents span many areas of computer science, from compilers and networking to 3D graphics.
Morgan cochaired the EuroGraphics Symposium on Rendering, the ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games, the ACM SIGGRAPH Symposium on Non-Photorealistic Animation and Rendering, and the ACM SIGGRAPH / EuroGraphics High Performance Rendering conference, and was the founding Editor-in-Chief of the Journal of Computer Graphics Techniques. Morgan is the author or coauthor of “the bible” of 3D, Computer Graphics: Principles & Practice 3rd Edition, The Graphics Codex, Creating Games, the G3D Innovation Engine, the Markdeep document system, and chapters of several GPU Gems, ShaderX, and GPU Pro volumes.
Morgan holds faculty positions at the University of Waterloo and McGill University and was a full professor at Williams College. Morgan received Ph.D. and M.S. degrees from Brown University and . and B.S. degrees from MIT.
Videos Filmed & Edited by Bash Films:
YouTube Channel Managed by Digital Medium Ltd
#cppcon #programming #cpp