错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Performance Analysis of Compiler Support for Parallel Evaluation of C++ Constant Expressions

  • Andrew Gozillon,
  • Seyed Hossein Haeri,
  • James Riordan,
  • Paul Keir

摘要

Metaprogramming, the practice of writing programs that manipulate other programs at compile-time, continues to impact software development; enabling new approaches to optimisation, static analysis, and reflection. Nevertheless, a challenge associated with metaprogramming techniques, including C++ constexpr functionality, is an increase in compilation times. This paper presents ClangOz, a novel Clang-based research compiler that addresses this issue by evaluating annotated constant expressions in parallel, thereby reducing compilation time. By evaluating constant expressions in parallel, ClangOz significantly reduces compilation times for metaprogramming-intensive codebases, enhancing developer productivity and iterative software development processes. To control this, ClangOz includes novel compiler intrinsics allowing developers to take full advantage of constexpr language features. New i9-13900K benchmark results here demonstrate the performance advantage of ClangOz over traditional compilers, including a decrease in compile times across more benchmarks; and 100% parallel efficiency in two cases. Also introduced here is the C’est library, which provides a subset of the C++ standard library, with extended constexpr support. We highlight applications of the constexpr language feature, and emphasise the relevance of ClangOz, a compiler tailored for parallel evaluation of relevant constant expressions. Developers can now utilise modern metaprogramming, while minimising compile times parametrically.