Thanks for watching! If you have any questions, feel free to leave them here in the comments and I will respond to them. Update: I'll be hosting part 2 at CppCon 2023 in October.
Hey, great talk. Would it be possible to share the presentation's source code? I have a feeling that it was made using reveal.js and I am interested in the details of how you managed to construct some of the slides. However, if this it not reveal.js or you do not wish to share the source of your presentation, just let me know - it's totally fine :)
I too was impressed by some of the slide animations - a step above PowerPoint, unless PP has stepped up its game recently (well, since the last time I used it - "some time ago")
@@treyquattro It did step up, but not enough for me. I originally tried using PowerPoint, but it wasn't flexible enough. One of the goals of my talk was to have visually attractive slides which convey information through animation because of the large information density.
I'm only part way through this (and will be back to finish it) but I've gotta say: it's SO nice to have one of these remote talks given by someone that has a good microphone and some enthusiasm for their content. Some of them are so hard to listen to.
13:58 There is a slight (or big?) difference between "if (std::is_constant_evaluated())" and "if consteval". The former is a *runtime* check for whether it is being evaluated at compile time BUT also allowed in places where one expects a constant result. While the later is a compile time check. Both have different usecases, and neither substitute the other. One can do "int arr[std::is_constant_evaluated() ? 10 : 15]" but cannot do so with "if consteval". One can call consteval functions from inside "if consteval", but cannot from inside "if (std::is_constant_evaluated())" since the check is at runtime.
The author looks like a little kid, and already knows the in and outs of performance programming across multiple levels. This is a great talk, honestly. You should use it as a great resume intro, that will land you a well-paid job in a great company.
Unfortunately, this kind of talent will likely get quickly used up and burned by private equity. It is what happens to most such talent. P.E. is the economic monster, a result of fake/Keynesian economics, and it wrecks everything.
Nice and quite complete work you could fit inside such a limited duration. Lot of concrete pointers where to start investigating things that could be optimized in c++ code. I have many years of experience in c++ and I'm almost jealous by all the knowledge you're able to share at your young age! The most important is that you seem to have experimented what you're talking about. I'll definitely keep a tag on this video for future reference. One of the best content on a highly debatable subject, in the past years.
Very good talk! A lot of pointers here that I preach in my day to day. You cover a lot of ground and go into just the right amount of detail. One thing worth adding for future talks is how virtual tables affect performance. I still see a lot of engineers who are taught the old school OOP paradigm and there is some contention between those that think virtual calls are absolutely evil and those that think they are a necessary evil.
This talk is a good aggregation of different optimizations. It can be used as a hint or a spreadsheet with optimizations just to recall them sometimes. Thanks.
The const bool part really helped! Normally, trying to put the if statement outside of the for loop is gonna make the code look bad. But a const bool solved it elegantly
Thanks! You can check the links shown on the first slide of the talk. TH-cam’s autonomous comment moderation is very restrictive about promoting other motion picture broadcasters’ outlets registered on the service. Hence, to creatively work around the commenting system’s limitations, I will say that the author of the presentation has also done other C++ talks, the recordings of which are also available on the platform.
As far as I know, as of now, only MSVC 19.32 and up supports a subset of P0847. I am also looking forward to wide adoption of this language feature, especially for its applications in CRTP.
very good presentation. My only issue was that Jan seemed to imply that thrashing is the normal situation of bringing in page files from backing storage whereas it's a pathological scenario in which paging-in memory virtually immediately results in a successive eviction of another page and this situation cascades, leading to a scenario in which all the process's CPU cycles are spent handling page faults. This scenario rarely - if ever - happens in modern computing.
That wasn't my intention. "If page faults occur frequently [...] this is called thrashing " was meant to be a summary of how you describe thrashing. I didn't want to spend time going into the details, as it wasn't really relevant for the talk.
21:19 since CPU will anyway predict the branch, the effect of [[likely]] is very small. I've seen it mainly in the better register allocation especially for x86-32 code (having only 6-7 registers at hand)
In this case, yes. This was only meant to be a minimal example. However, it is important to remember that the BTB (Branch Target Buffer) has a limited capacity. If this function is called rarely, then it doesn't matter that the branch wouldn't be cached in the BTB, as it's overhead would be low (because of the rarity). However, if there would be a lot of, theoretically, well predictable branches, being constantly executed (or at least more than the BTB can handle), then branch prediction performance would be suboptimal.
Impressive preso you really know what you're talking about. What I would appreciate is an indication for the various C++ keywords that appear in the code snippets and elsewhere in which C++ version they were introduced.
Very necessary lecture. I don't think I took as much away from any other lecture as I have taken from this lecture. I always wanted to write my own malloc replacement but mimalloc does the job. Never knew it existed until this lecture (head buried in sand syndrome). As I only write real-time on Widows (Linux debugger not fit for real-time debugging, developed all my real-time for Linux on Solaris sparc then ported to Linux) I decided just to go with mimalloc. Still not sure if Linux debugger has been improved but I got burnt so badly by it I decided never again. As an old dog of a programmer I'm currently going through the forge of bringing myself up to date. C++20 is really nice but I have to admit I am looking forward to C++23 so will delay my development until C++23 is out and in the meantime will spend the time on re-educating myself. In my day colleges and universities used Cobol and Pascal. Not even sure those two exist now. Not sure why they did not settle on Fortran. Still don't know why ML does not favour Fortran but I am a C++ and Java programmer and refuse to move from those two as I am just too old. Note: Hate Java, but it pays the rent. I ported to iRMX too using Intel C/C++ compiler back in the day. Sometimes to get the best performance you need to develop in the Kernel. I did that to re-write the Microsoft NT serial driver as it was too inefficient.
Hi, the commenting system’s automatic moderation policies prevent posting links in the comments or mentioning profiles on other social media platforms. You can check out the Vectoriser repository from an account to which a link is provided on the first slide of the talk.
@@janbielak Thanks. TH-cam's moderation policies about links can be annoying. You can post the links in the summary. That way TH-cam knows you are not a rando posting links to exploit websites of something.
It's impressive that this list more or less complete of actually what to do when you plan performance optimizations. Well presented and concise with examples. Probably the only wish was to elaborate more on the branch predictions. But bloody good efforts.
Hi, the slides are made in Slides (editor). I cannot post the link because TH-cam doesn’t like that, you should be able to find it by searching for the name of the talk.
Hi, the slides are made in Slides (editor). I cannot post the link because TH-cam doesn’t like that, you should be able to find it by searching for the name of the talk.
Great summary, my only big problem is the title. The most important optimization by multiple orders of magnitude will always be algorithmic complexity. If your program is bubble sort, you can apply everything in this video and it will still be slower (on average) than a proper sorting algorithm.
Hi, I agree that algorithmic complexity has a significantly larger impact on performance than all of the presented techniques. I do mention that at the beginning of the talk. Regardless, the talk is about optimizations that apply to some given program. I assume that programs using different algorithms are different (potentially) unoptimized programs, in the sense of language and hardware efficiency - the main classes of techniques covered in the talk.
Nice Presentation. But by the end of the obvious side reading from a script became to monotone. Even if it takes longer to prepare it would be much nice to hear a normal person speaking in their natural mannerism other than just reciting the video's script
This should be renamed to "Optimization of C++ programs for dummies". It's just an overview of different techniques, often without examples what it gives.
The main purpose of the talk was to inform of optimization opportunities, rather than their applications. That’s because the domain of optimization is very large. If all optimization knowledge were a book, this talk would be (a part of) its table of contents. This is the talk I would’ve wished to see instead of having to look around the internet. There is plenty of information about each of these techniques, but I am yet to see an approachable review of many different ones.
@@SqueakyNeb It's not 'goofy' in any meaning of 'goofy'. Well done, Jan, a well thought out and well-presented talk! (Trolls will troll, please ignore their stupid comments)
Thanks for watching! If you have any questions, feel free to leave them here in the comments and I will respond to them.
Update: I'll be hosting part 2 at CppCon 2023 in October.
Hey, great talk. Would it be possible to share the presentation's source code? I have a feeling that it was made using reveal.js and I am interested in the details of how you managed to construct some of the slides. However, if this it not reveal.js or you do not wish to share the source of your presentation, just let me know - it's totally fine :)
I too was impressed by some of the slide animations - a step above PowerPoint, unless PP has stepped up its game recently (well, since the last time I used it - "some time ago")
Great talk! Thanks 👍
@@treyquattro It did step up, but not enough for me. I originally tried using PowerPoint, but it wasn't flexible enough. One of the goals of my talk was to have visually attractive slides which convey information through animation because of the large information density.
Excellent talk, enjoyed it.
This talk was one of the most comprehensive, complete and approachable overviews of performance considerations in C++ I have ever seen. Just amazing!
I'm only part way through this (and will be back to finish it) but I've gotta say: it's SO nice to have one of these remote talks given by someone that has a good microphone and some enthusiasm for their content. Some of them are so hard to listen to.
True. As someone to whom English is not the first language, I can manage an accent or a bad microphone ... but not both.
It's amazing that you managed to cover all these topics in just one hour. It gave me a lot of ideas. Thanks!
13:58 There is a slight (or big?) difference between "if (std::is_constant_evaluated())" and "if consteval". The former is a *runtime* check for whether it is being evaluated at compile time BUT also allowed in places where one expects a constant result. While the later is a compile time check. Both have different usecases, and neither substitute the other. One can do "int arr[std::is_constant_evaluated() ? 10 : 15]" but cannot do so with "if consteval". One can call consteval functions from inside "if consteval", but cannot from inside "if (std::is_constant_evaluated())" since the check is at runtime.
The author looks like a little kid, and already knows the in and outs of performance programming across multiple levels.
This is a great talk, honestly.
You should use it as a great resume intro, that will land you a well-paid job in a great company.
Unfortunately, this kind of talent will likely get quickly used up and burned by private equity. It is what happens to most such talent. P.E. is the economic monster, a result of fake/Keynesian economics, and it wrecks everything.
@@vcoolwhat would you advise such talent to not get used up and burned up by private company? Create your own?
This is a really well-organized and comprehensive presentation. Kudos and thank you!
Nice and quite complete work you could fit inside such a limited duration.
Lot of concrete pointers where to start investigating things that could be optimized in c++ code.
I have many years of experience in c++ and I'm almost jealous by all the knowledge you're able to share at your young age!
The most important is that you seem to have experimented what you're talking about.
I'll definitely keep a tag on this video for future reference.
One of the best content on a highly debatable subject, in the past years.
I'm only halfway through but the flowchart at 30:00 on passing parameters is golden
Very good talk! A lot of pointers here that I preach in my day to day. You cover a lot of ground and go into just the right amount of detail. One thing worth adding for future talks is how virtual tables affect performance. I still see a lot of engineers who are taught the old school OOP paradigm and there is some contention between those that think virtual calls are absolutely evil and those that think they are a necessary evil.
I'll keep that in mind when working on version 2.0 for CppCon23
This is one of the best presentations out here for C++
This talk is a good aggregation of different optimizations. It can be used as a hint or a spreadsheet with optimizations just to recall them sometimes. Thanks.
That's a lot of info in a short amount of time, while still being easy to grasp. Great talk!
Best performance talk I watched for 2022 :)
Great Talk! Looking forward to the next talks of you.
Great talk Jan Bielak! 🤝
Killer talk. Very helpful. Will likely rewatch several times
High quality presentation. Thanks Jan!
Very nice presentation. The dude is in high school and already nailing it with c++
Thanks, very informative and easy to apply. I need a poster of slide 23 :)
commendable job, very well done. thanks a lot for keeping it precise and succinct.
Great presentation, I like the visualization and the order of subjects.
This is brilliant. Thank you.
The const bool part really helped! Normally, trying to put the if statement outside of the for loop is gonna make the code look bad. But a const bool solved it elegantly
can you say where exactly is this part?
I'm going to look for more content from Jan!
Great presentation!!!!
Thanks! You can check the links shown on the first slide of the talk. TH-cam’s autonomous comment moderation is very restrictive about promoting other motion picture broadcasters’ outlets registered on the service. Hence, to creatively work around the commenting system’s limitations, I will say that the author of the presentation has also done other C++ talks, the recordings of which are also available on the platform.
35:50
I haven't dug into C++23 because i can't use it...but i love this.
Been wanting something like this for awhile.
As far as I know, as of now, only MSVC 19.32 and up supports a subset of P0847. I am also looking forward to wide adoption of this language feature, especially for its applications in CRTP.
A great and most useful talk! Thank you!
Thanks!
Very informative and comprehensive presentation of the topic!
very good presentation. My only issue was that Jan seemed to imply that thrashing is the normal situation of bringing in page files from backing storage whereas it's a pathological scenario in which paging-in memory virtually immediately results in a successive eviction of another page and this situation cascades, leading to a scenario in which all the process's CPU cycles are spent handling page faults. This scenario rarely - if ever - happens in modern computing.
That wasn't my intention. "If page faults occur frequently [...] this is called thrashing " was meant to be a summary of how you describe thrashing. I didn't want to spend time going into the details, as it wasn't really relevant for the talk.
21:19 since CPU will anyway predict the branch, the effect of [[likely]] is very small. I've seen it mainly in the better register allocation especially for x86-32 code (having only 6-7 registers at hand)
In this case, yes. This was only meant to be a minimal example. However, it is important to remember that the BTB (Branch Target Buffer) has a limited capacity. If this function is called rarely, then it doesn't matter that the branch wouldn't be cached in the BTB, as it's overhead would be low (because of the rarity). However, if there would be a lot of, theoretically, well predictable branches, being constantly executed (or at least more than the BTB can handle), then branch prediction performance would be suboptimal.
Very informative and compact! Thank you for all the ideas.
Excellent talk and advices
Impressive preso you really know what you're talking about. What I would appreciate is an indication for the various C++ keywords that appear in the code snippets and elsewhere in which C++ version they were introduced.
This is very impressive
For 17. Use static for internal linkage, why use static rather than an anonymous namespace? C++ Core Guidelines SF.22 suggests anonymous namespaces.
That's correct, I forgot to mention inline namespaces as an alternative to static.
Very necessary lecture. I don't think I took as much away from any other lecture as I have taken from this lecture. I always wanted to write my own malloc replacement but mimalloc does the job. Never knew it existed until this lecture (head buried in sand syndrome). As I only write real-time on Widows (Linux debugger not fit for real-time debugging, developed all my real-time for Linux on Solaris sparc then ported to Linux) I decided just to go with mimalloc. Still not sure if Linux debugger has been improved but I got burnt so badly by it I decided never again. As an old dog of a programmer I'm currently going through the forge of bringing myself up to date. C++20 is really nice but I have to admit I am looking forward to C++23 so will delay my development until C++23 is out and in the meantime will spend the time on re-educating myself. In my day colleges and universities used Cobol and Pascal. Not even sure those two exist now. Not sure why they did not settle on Fortran. Still don't know why ML does not favour Fortran but I am a C++ and Java programmer and refuse to move from those two as I am just too old. Note: Hate Java, but it pays the rent. I ported to iRMX too using Intel C/C++ compiler back in the day. Sometimes to get the best performance you need to develop in the Kernel. I did that to re-write the Microsoft NT serial driver as it was too inefficient.
nice summary, thanks
This is very interesting!!!
C++23 explicit object parameter declaration -- back to the roots. I hope we can get rid of objects altogether in the future.
Wow. Great talk 🎉 where is part 2
Can you please post a link to the vectorizer utility. Thanks.
Hi, the commenting system’s automatic moderation policies prevent posting links in the comments or mentioning profiles on other social media platforms. You can check out the Vectoriser repository from an account to which a link is provided on the first slide of the talk.
@@janbielak Thanks. TH-cam's moderation policies about links can be annoying. You can post the links in the summary. That way TH-cam knows you are not a rando posting links to exploit websites of something.
It's impressive that this list more or less complete of actually what to do when you plan performance optimizations.
Well presented and concise with examples. Probably the only wish was to elaborate more on the branch predictions.
But bloody good efforts.
Very helpful. Maybe someone has a wiki page to list all these helpful optimization gotchas?
The StackOverflow x86 tag wiki is a good place to start.
Thanks. Checked but not what I expected. I saw a list at the end of this video which kind of a good one. I shall print it :)
Great talk!
where is the presentation, please? would like to keep it as a guidance.
Hi, the slides are made in Slides (editor). I cannot post the link because TH-cam doesn’t like that, you should be able to find it by searching for the name of the talk.
where can I find slides? As of 18 January of 2023 the repo in the description doesn't contain it.
Hi, the slides are made in Slides (editor). I cannot post the link because TH-cam doesn’t like that, you should be able to find it by searching for the name of the talk.
That flowchart for function call sites imo should be memorized by every cpp programmer.
would be great to see something in similar vein to graphics programming 👍
He seems so young to have such experience.
Great summary, my only big problem is the title. The most important optimization by multiple orders of magnitude will always be algorithmic complexity. If your program is bubble sort, you can apply everything in this video and it will still be slower (on average) than a proper sorting algorithm.
Hi, I agree that algorithmic complexity has a significantly larger impact on performance than all of the presented techniques. I do mention that at the beginning of the talk. Regardless, the talk is about optimizations that apply to some given program. I assume that programs using different algorithms are different (potentially) unoptimized programs, in the sense of language and hardware efficiency - the main classes of techniques covered in the talk.
Great!
nice talk!
slide 23 is the sad daily dilemma of c++ programmers :(
Im gettin old
Nice Presentation. But by the end of the obvious side reading from a script became to monotone. Even if it takes longer to prepare it would be much nice to hear a normal person speaking in their natural mannerism other than just reciting the video's script
coooooooooooool
string_view is almost always useless because it can't garantee zero ending for OS\C api usage
This should be renamed to "Optimization of C++ programs for dummies".
It's just an overview of different techniques, often without examples what it gives.
The main purpose of the talk was to inform of optimization opportunities, rather than their applications. That’s because the domain of optimization is very large. If all optimization knowledge were a book, this talk would be (a part of) its table of contents. This is the talk I would’ve wished to see instead of having to look around the internet. There is plenty of information about each of these techniques, but I am yet to see an approachable review of many different ones.
presentation is way too goofy. Couldn't make it past the 5 minute mark.
Sounds like you're just salty because a high schooler knows more than you. Where's your CppCon talk bud?
What's "goofy" about it?
@@SqueakyNeb It's not 'goofy' in any meaning of 'goofy'. Well done, Jan, a well thought out and well-presented talk! (Trolls will troll, please ignore their stupid comments)
I think that's a you problem. Content was great and very to the point.
@@SqueakyNeb I think it was read, so there was no ad libbing but its okay.
Also (**holy cow** )the speaker is a High school student!!!