Skip to content
0:00 / 0:00

#compilerexplorer#pathtracing#raytracing

CppCon 2019: Matt Godbolt “Path Tracing Three Ways: A Study of C++ Style”

CppCon

189K subscribers • 103 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 1 on Hacker News and 1 in engineering communities.
  • Presented by Matt Godbolt, creator of Compiler Explorer
  • Linked in the descriptionCppCon/CppCon2019

Advanced. Deep dive for people who know the field.

77K views7 years ago2 recommendations

Programming languagesGraphics and audioC++RenderingPerformance and optimization

Matt Godbolt compares object-oriented, functional, and data-oriented implementations of a path tracer in C++ to analyze their performance and clarity.

CppCon.org — Discussion & Comments: reddit.com/r/cpp/ — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2019 — C++ is a multi-paradigm language allowing us as developers to pick and choose among a variety of styles: procedural, functional, object oriented, hybrids, and more. How does the style of programming we choose affect code clarity, testability, ease of changes, compile time and run-time performance? In this talk Matt will show a toy path tracer project (a form of ray tracer) implemented in three different styles: traditional object oriented, functional, and data-oriented design. He'll then compare and contrast his experiences developing in each case, showing how often the compiler is able to reduce each style to similar performing code. There's certain to be some surprises - and of course some Compiler Explorer usage! — Matt Godbolt Aquatic Capital Management, LLC Development Engineer Greater Chicago Area Matt Godbolt is the creator of the Compiler Explorer website. He is passionate about writing efficient code. He has previously worked at a trading firm, on mobile apps at Google, run his own C++ tools company and spent more than a decade making console games. When he's not hacking on Compiler Explorer, Matt enjoys writing emulators for old 8-bit computer hardware. — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctf

Why it's here

2 people recommend this

What people say. Recommended for its insightful comparison of programming paradigms and how modern compilers optimize different C++ styles.

u/skeetoin r/GraphicsProgramming • Recommends

CppCon 2019: Matt Godbolt “Path Tracing Three Ways: A Study of C++ Style”

meheleventyoneon Hacker News • Recommends

On “Mispredicted branches can multiply your running times”

…s there are also a lot who haven't and are still interested. It seems rather snobby to jump in and write off a bunch of people because of the language they use on the assumption that they use the language without being aware of the implications. On OOP versus more cache friendly approaches and branch prediction this talk from CPPCon 2019 is great: link to this video The interesting result is that although the DoD approach is eventually faster a branch misprediction causes havoc until uncovered.…

u/Nathanfennerin r/ProgrammingLanguages • Mentions

On “Opinions on Jonathan Blow's Jai?”

Jai makes a few interesting decisions. But it's important to consider the very specific niche it's attempting to fill: a replacement for C++ for games. From this perspective, it makes sense: it is a big improvement on C++, but it doesn't do *that* much new. In my own words, I'll summarize what I consider to be Blow's goals: - Compile quickly ("1 million lines of code per second") - Produce efficient executables (in particular, avoid hiding things behind mandatory abstractions that make it difficult/impossible to write code that runs as-quickly-as-possible on the target platform) - Get out of the programmer's way when they know what they're doing (including allowing them to make mistakes or…

u/dom324324in r/Zig • Mentions

On “Data-oriented design resources”

…where you first think about how your data looks and what do you need to do with it. Based on that you pick a layout of your data structures, write alghorithms and code such that your data is handled efficiently. Many people argue that this can in the end result in cleaner/better code. This video tries to explain DOD and compare it too OOP and FP link to this video He points out that DOD has (in his opinion) worse testability and is more difficult to change, I think that it can be true, however I think it is a result of languages having zero support for DOD (e.g. no easy way how to switch between soa/aos).…

u/dom324324in r/Zig • Mentions

On “Data-oriented design resources”

Probably the best resource is Casey Muratori link to this video (I love this video, he shows DOD on a real application with a massive speed up) , he has bunch of videos not directly aimed at DOD, but much of his principles align with it. Also he has some new course, maybe worth to check that out. Matt Godbolt and his talk is also good link to this video Not DOD, but the Performance Ninja Course teaches about optimization, from which you can get better understanding why DOD is fast https://github.com/dendibakh/perf-ninja

slavik81on Hacker News • Mentions

On “Google broke a conditional statement that verifies passwords on Chrome OS”

Matt Godbolt gave an example of a significant performance hit caused by unnecessary short-circuiting in his CppCon 2019 talk1. EDIT: Deleted tangent. 1: link to this video

rdc12on Hacker News • Mentions

On “You can't fool the optimizer”

Matt Godbolt's talk on ray tracers, shows how effective that change can be. Think it was that talk anyway. link to this video