{"id":8628,"date":"2014-03-28T18:12:47","date_gmt":"2014-03-28T22:12:47","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=8628"},"modified":"2014-03-28T18:12:47","modified_gmt":"2014-03-28T22:12:47","slug":"warp-a-fast-c-and-c-preprocessor","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/03\/28\/warp-a-fast-c-and-c-preprocessor\/","title":{"rendered":"Warp, a Fast C and C++ Preprocessor"},"content":{"rendered":"<p>Andrei Alexandrescu <a href=\"https:\/\/code.facebook.com\/posts\/476987592402291\/under-the-hood-warp-a-fast-c-and-c-preprocessor\/\">interviews<\/a> Walter Bright:<\/p>\n<blockquote cite=\"https:\/\/code.facebook.com\/posts\/476987592402291\/under-the-hood-warp-a-fast-c-and-c-preprocessor\/\"><p>Conventional wisdom has it that preprocessing time is a negligible part of building a C++ binary. C++ is notoriously difficult to parse, which means that C++ parsers tend to be large and slow compared to their counterparts for other languages. Code generation is also quite the time sink, especially if you&rsquo;re using optimizations. Finally, linking is a large serial step at the end of each build, and using <a href=\"http:\/\/en.wikipedia.org\/wiki\/Gold_(linker)\">the gold linker<\/a> only helps so much. Therefore, it would seem that the lowly task of going through the included files and expanding macros would take a comparatively short time and be essentially impossible to improve upon.<\/p>\n<p>Not so! Replacing gcc&rsquo;s preprocessor with warp has led to significant improvements of our end-to-end build times (including linking). Depending on a variety of circumstances, we measured debug build speed improvements ranging from 10% all the way to 40%, all in complex projects with massive codebases and many dependencies. That&rsquo;s not per-file speed, but rather global times measured for scenarios like &ldquo;build after changing a header file.&rdquo;<\/p><\/blockquote>\n<p>There sure are a lot of A-players at Facebook.<\/p>","protected":false},"excerpt":{"rendered":"<p>Andrei Alexandrescu interviews Walter Bright: Conventional wisdom has it that preprocessing time is a negligible part of building a C++ binary. C++ is notoriously difficult to parse, which means that C++ parsers tend to be large and slow compared to their counterparts for other languages. Code generation is also quite the time sink, especially if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[45,255,834,25,285,74,138,71,835],"class_list":["post-8628","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-c","tag-compiler","tag-d-programming-language","tag-facebook","tag-gcc","tag-opensource","tag-optimization","tag-programming","tag-warp"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=8628"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8628\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=8628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=8628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=8628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}