These are the slides from my CppCon 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=gKbORJtnVu8. All my other talks can be found here: https://train-it.eu/resources.
---
This short talk presents how easy it is to replace some cases of dynamic polymorphism with std::variant. During the lecture, we will analyze and compare 2 implementations of the same simple Finite State Machine. It turns up that variant-based code is not only much faster but also it gives us the opportunity to define our interfaces and program flow much better. The talk will end up with the discussion of pros and cons of each approach and will try to give guidelines on when to use them.
Effective replacement of dynamic polymorphism with std::variantMateusz Pusz
These are the slides from my ACCU 2019 talk. You can find the recording here: https://www.youtube.com/watch?v=JGYxOieiZnY. All my other talks can be found here: https://train-it.eu/resources.
---
This short talk presents how easy it is to replace some cases of dynamic polymorphism with std::variant. During the lecture, we will analyze and compare a few implementations of the same simple Finite State Machine. It turns up that variant-based code is not only much faster but also it gives us the opportunity to define our interfaces and program flow much better. The talk will end up with the discussion of pros and cons of each approach and will try to give guidelines on when to use them.
Netronome's half-day tutorial on host data plane acceleration at ACM SIGCOMM 2018 introduced attendees to models for host data plane acceleration and provided an in-depth understanding of SmartNIC deployment models at hyperscale cloud vendors and telecom service providers.
Presenter Bios
Jakub Kicinski is a long term Linux kernel contributor, who has been leading the kernel team at Netronome for the last two years. Jakub’s major contributions include the creation of BPF hardware offload mechanisms in the kernel and bpftool user space utility, as well as work on the Linux kernel side of OVS offload.
David Beckett is a Software Engineer at Netronome with a strong technical background of computer networks including academic research with DDoS. David has expertise in the areas of Linux architecture and computer programming. David has a Masters Degree in Electrical, Electronic Engineering at Queen’s University Belfast and continues as a PhD student studying Emerging Application Layer DDoS threats.
Effective replacement of dynamic polymorphism with std::variantMateusz Pusz
These are the slides from my ACCU 2019 talk. You can find the recording here: https://www.youtube.com/watch?v=JGYxOieiZnY. All my other talks can be found here: https://train-it.eu/resources.
---
This short talk presents how easy it is to replace some cases of dynamic polymorphism with std::variant. During the lecture, we will analyze and compare a few implementations of the same simple Finite State Machine. It turns up that variant-based code is not only much faster but also it gives us the opportunity to define our interfaces and program flow much better. The talk will end up with the discussion of pros and cons of each approach and will try to give guidelines on when to use them.
Netronome's half-day tutorial on host data plane acceleration at ACM SIGCOMM 2018 introduced attendees to models for host data plane acceleration and provided an in-depth understanding of SmartNIC deployment models at hyperscale cloud vendors and telecom service providers.
Presenter Bios
Jakub Kicinski is a long term Linux kernel contributor, who has been leading the kernel team at Netronome for the last two years. Jakub’s major contributions include the creation of BPF hardware offload mechanisms in the kernel and bpftool user space utility, as well as work on the Linux kernel side of OVS offload.
David Beckett is a Software Engineer at Netronome with a strong technical background of computer networks including academic research with DDoS. David has expertise in the areas of Linux architecture and computer programming. David has a Masters Degree in Electrical, Electronic Engineering at Queen’s University Belfast and continues as a PhD student studying Emerging Application Layer DDoS threats.
The magic behind your Lyft ride prices: A case study on machine learning and ...Karthik Murugesan
Rakesh Kumar and Thomas Weise explore how Lyft dynamically prices its rides with a combination of various data sources, ML models, and streaming infrastructure for low latency, reliability, and scalability—allowing the pricing system to be more adaptable to real-world changes.
Combining Phase Identification and Statistic Modeling for Automated Parallel ...Mingliang Liu
Parallel application benchmarks are indispensable for evaluating/optimizing HPC software and hardware. However, it is very challenging and costly to obtain high-fidelity benchmarks reflecting the scale and complexity of state-of-the-art parallel applications. Hand-extracted synthetic benchmarks are time- and labor-intensive to create. Real applications themselves, while offering most accurate performance evaluation, are expensive to compile, port, reconfigure, and often plainly inaccessible due to security or ownership concerns. This work contributes APPrime, a novel tool for trace-based automatic parallel benchmark generation. Taking as input standard communication-I/O traces of an application's execution, it couples accurate automatic phase identification with statistical regeneration of event parameters to create compact, portable, and to some degree reconfigurable parallel application benchmarks. Experiments with four NAS Parallel Benchmarks (NPB) and three real scientific simulation codes confirm the fidelity of APPrime benchmarks. They retain the original applications' performance characteristics, in particular their relative performance across platforms. Also, the result benchmarks, already released online, are much more compact and easy-to-port compared to the original applications.
http://dl.acm.org/citation.cfm?id=2745876
Applying Linear Optimization Using GLPKJeremy Chen
A brief introduction to linear optimization with a focus on applying it with the high-quality open-source solver GLPK.
Originally prepared for an intra-department sharing session.
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward
At Lyft we dynamically price our rides with a combination of various data sources, machine learning models, and streaming infrastructure for low latency, reliability and scalability. Dynamic pricing allows us to quickly adapt to real world changes and be fair to drivers (by say raising rates when there's a lot of demand) and fair to passengers (by let’s say offering to return 10 mins later for a cheaper rate). To accomplish this, our system consumes a massive amount of events from different sources.
The streaming platform powers pricing by bringing together the best of two worlds using Apache Beam; ML algorithms in Python/Tensorflow and Apache Flink as the streaming engine. Enablement of data science tools for machine learning and a process that allows for faster deployment is of growing importance for the business. Topics covered in this talk include:
* Examples for dynamic pricing based on real-time event streams, including location of driver, ride requests, user session event and based on machines learning models
* Comparison of legacy system and new streaming platform for dynamic pricing
* Processing live events in realtime to generate features for machine learning models
* Overview of streaming platform architecture and technology stack
* Apache Beam portability framework as bridge to distributed execution without code rewrite for JVM based streaming engine
* Lessons learned
Streaming your Lyft Ride Prices - Flink Forward SF 2019Thomas Weise
At Lyft we dynamically price our rides with a combination of various data sources, machine learning models, and streaming infrastructure for low latency, reliability and scalability. Dynamic pricing allows us to quickly adapt to real world changes and be fair to drivers (by say raising rates when there's a lot of demand) and fair to passengers (by let’s say offering to return 10 mins later for a cheaper rate). The streaming platform powers pricing by bringing together the best of two worlds using Apache Beam; ML algorithms in Python and Apache Flink as the streaming engine.
https://sf-2019.flink-forward.org/conference-program#streaming-your-lyft-ride-prices
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward
Streaming your Lyft Ride Prices
At Lyft we dynamically price our rides with a combination of various data sources, machine learning models, and streaming infrastructure for low latency, reliability and scalability. Dynamic pricing allows us to quickly adapt to real world changes and be fair to drivers (by say raising rates when there's a lot of demand) and fair to passengers (by let’s say offering to return 10 mins later for a cheaper rate). To accomplish this, our system consumes a massive amount of events from different sources.
The streaming platform powers pricing by bringing together the best of two worlds using Apache Beam; ML algorithms in Python/Tensorflow and Apache Flink as the streaming engine. Enablement of data science tools for machine learning and a process that allows for faster deployment is of growing importance for the business. Topics covered in this talk include:
* Examples for dynamic pricing based on real-time event streams, including location of driver, ride requests, user session event and based on machines learning models
* Comparison of legacy system and new streaming platform for dynamic pricing
* Processing live events in realtime to generate features for machine learning models
* Overview of streaming platform architecture and technology stack
* Apache Beam portability framework as bridge to distributed execution without code rewrite for JVM based streaming engine
* Lessons learned
Flowex - Railway Flow-Based Programming with Elixir GenStage.Anton Mishchuk
Flowex is a set of abstractions build on top Elixir GenStage which allows writing program with Flow-Based Programming paradigm.
I would say it is a mix of FBP and so-called Railway Oriented Programming (ROP) approach.
Flowex DSL allows you to easily create "pipelines" of Elixir GenStages.
Data Science at Scale on MPP databases - Use Cases & Open Source ToolsEsther Vasiete
Pivotal workshop slide deck for Structure Data 2016 held in San Francisco.
Abstract:
Learn how data scientists at Pivotal build machine learning models at massive scale on open source MPP databases like Greenplum and HAWQ (under Apache incubation) using in-database machine learning libraries like MADlib (under Apache incubation) and procedural languages like PL/Python and PL/R to take full advantage of the rich set of libraries in the open source community. This workshop will walk you through use cases in text analytics and image processing on MPP.
An Empirical Study On Practicality Of Specification Mining Algorithms On A Re...Mohammad Jafar Mashhadi
An Empirical Study on Practicality of Specification Mining Algorithms on a Real-world Application at the International Conference on Program Comprehension (ICPC) 2019
From GameMaker to Game Baker - Porting Hotline MiamiFrans Kasper
Slides from a talk I did at the 2015 Control Conference covering the process of porting Hotline Miami 1 and 2 from a propietary engine (GameMaker), without source access to platforms the engine does not support.
Presentation of the paper "Verification of Relational Data-Centric Dynamic Systems with External Services" at the 32nd ACM SIGACT SIGMOD SIGART Symposium on Principles of Database Systems (PODS 2013)
Free Lunch is Over: Why is C++ so Important in the Modern World?Mateusz Pusz
"Don’t pay for what you don’t use" and "Don't leave room for a language below C++ (except assembler)" are the C++ design and evolution priorities that have stuck with us since the beginning of the programming language. CPU clock frequencies stopped growing more than 10 years ago, and since that time, our processor cores are no longer accelerating. Moreover, the demand for power savings is higher than ever for both small factor devices, like mobile phones, and for huge factor server farms. In the domains where each CPU cycle counts, C++ is the fastest and the most robust solution on the market. C++ programming language is evolving faster now than ever before — and EPAM is an active contributor to this transformation. This talk will briefly summarize the history of C++, describe the benefits of the programming language, highlight the business domains where its usage is essential, and provide some insights on the future of the language and its standardization process.
A Physical Units Library for the Next C++Mateusz Pusz
These are the slides from my CppCon 2020 talk. You can find the recording here: https://www.youtube.com/watch?v=7dExYGSOJzo. All my other talks can be found here: https://train-it.eu/resources.
---
During CppCon 2019 Mateusz provided an overview of current solutions on the market as well as challenges of implementing a modern C++ physical units library. This year's talk will focus on 'mp-units', the library that was developed by Mateusz and contributors, and which is proposed for C++ standardization. During the tutorial, we will get familiar with the building blocks of the library's framework and its most important concepts. Numerous code examples will present how to use and solve real-life problems with the library. The audience will learn how easy it is to extend it with new units, dimensions, or even whole new systems of quantities. Last but not least Mateusz will provide a fair comparison of how well this library performs in comparison to other products on the market.
More Related Content
Similar to Effective replacement of dynamic polymorphism with std::variant
The magic behind your Lyft ride prices: A case study on machine learning and ...Karthik Murugesan
Rakesh Kumar and Thomas Weise explore how Lyft dynamically prices its rides with a combination of various data sources, ML models, and streaming infrastructure for low latency, reliability, and scalability—allowing the pricing system to be more adaptable to real-world changes.
Combining Phase Identification and Statistic Modeling for Automated Parallel ...Mingliang Liu
Parallel application benchmarks are indispensable for evaluating/optimizing HPC software and hardware. However, it is very challenging and costly to obtain high-fidelity benchmarks reflecting the scale and complexity of state-of-the-art parallel applications. Hand-extracted synthetic benchmarks are time- and labor-intensive to create. Real applications themselves, while offering most accurate performance evaluation, are expensive to compile, port, reconfigure, and often plainly inaccessible due to security or ownership concerns. This work contributes APPrime, a novel tool for trace-based automatic parallel benchmark generation. Taking as input standard communication-I/O traces of an application's execution, it couples accurate automatic phase identification with statistical regeneration of event parameters to create compact, portable, and to some degree reconfigurable parallel application benchmarks. Experiments with four NAS Parallel Benchmarks (NPB) and three real scientific simulation codes confirm the fidelity of APPrime benchmarks. They retain the original applications' performance characteristics, in particular their relative performance across platforms. Also, the result benchmarks, already released online, are much more compact and easy-to-port compared to the original applications.
http://dl.acm.org/citation.cfm?id=2745876
Applying Linear Optimization Using GLPKJeremy Chen
A brief introduction to linear optimization with a focus on applying it with the high-quality open-source solver GLPK.
Originally prepared for an intra-department sharing session.
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward
At Lyft we dynamically price our rides with a combination of various data sources, machine learning models, and streaming infrastructure for low latency, reliability and scalability. Dynamic pricing allows us to quickly adapt to real world changes and be fair to drivers (by say raising rates when there's a lot of demand) and fair to passengers (by let’s say offering to return 10 mins later for a cheaper rate). To accomplish this, our system consumes a massive amount of events from different sources.
The streaming platform powers pricing by bringing together the best of two worlds using Apache Beam; ML algorithms in Python/Tensorflow and Apache Flink as the streaming engine. Enablement of data science tools for machine learning and a process that allows for faster deployment is of growing importance for the business. Topics covered in this talk include:
* Examples for dynamic pricing based on real-time event streams, including location of driver, ride requests, user session event and based on machines learning models
* Comparison of legacy system and new streaming platform for dynamic pricing
* Processing live events in realtime to generate features for machine learning models
* Overview of streaming platform architecture and technology stack
* Apache Beam portability framework as bridge to distributed execution without code rewrite for JVM based streaming engine
* Lessons learned
Streaming your Lyft Ride Prices - Flink Forward SF 2019Thomas Weise
At Lyft we dynamically price our rides with a combination of various data sources, machine learning models, and streaming infrastructure for low latency, reliability and scalability. Dynamic pricing allows us to quickly adapt to real world changes and be fair to drivers (by say raising rates when there's a lot of demand) and fair to passengers (by let’s say offering to return 10 mins later for a cheaper rate). The streaming platform powers pricing by bringing together the best of two worlds using Apache Beam; ML algorithms in Python and Apache Flink as the streaming engine.
https://sf-2019.flink-forward.org/conference-program#streaming-your-lyft-ride-prices
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward
Streaming your Lyft Ride Prices
At Lyft we dynamically price our rides with a combination of various data sources, machine learning models, and streaming infrastructure for low latency, reliability and scalability. Dynamic pricing allows us to quickly adapt to real world changes and be fair to drivers (by say raising rates when there's a lot of demand) and fair to passengers (by let’s say offering to return 10 mins later for a cheaper rate). To accomplish this, our system consumes a massive amount of events from different sources.
The streaming platform powers pricing by bringing together the best of two worlds using Apache Beam; ML algorithms in Python/Tensorflow and Apache Flink as the streaming engine. Enablement of data science tools for machine learning and a process that allows for faster deployment is of growing importance for the business. Topics covered in this talk include:
* Examples for dynamic pricing based on real-time event streams, including location of driver, ride requests, user session event and based on machines learning models
* Comparison of legacy system and new streaming platform for dynamic pricing
* Processing live events in realtime to generate features for machine learning models
* Overview of streaming platform architecture and technology stack
* Apache Beam portability framework as bridge to distributed execution without code rewrite for JVM based streaming engine
* Lessons learned
Flowex - Railway Flow-Based Programming with Elixir GenStage.Anton Mishchuk
Flowex is a set of abstractions build on top Elixir GenStage which allows writing program with Flow-Based Programming paradigm.
I would say it is a mix of FBP and so-called Railway Oriented Programming (ROP) approach.
Flowex DSL allows you to easily create "pipelines" of Elixir GenStages.
Data Science at Scale on MPP databases - Use Cases & Open Source ToolsEsther Vasiete
Pivotal workshop slide deck for Structure Data 2016 held in San Francisco.
Abstract:
Learn how data scientists at Pivotal build machine learning models at massive scale on open source MPP databases like Greenplum and HAWQ (under Apache incubation) using in-database machine learning libraries like MADlib (under Apache incubation) and procedural languages like PL/Python and PL/R to take full advantage of the rich set of libraries in the open source community. This workshop will walk you through use cases in text analytics and image processing on MPP.
An Empirical Study On Practicality Of Specification Mining Algorithms On A Re...Mohammad Jafar Mashhadi
An Empirical Study on Practicality of Specification Mining Algorithms on a Real-world Application at the International Conference on Program Comprehension (ICPC) 2019
From GameMaker to Game Baker - Porting Hotline MiamiFrans Kasper
Slides from a talk I did at the 2015 Control Conference covering the process of porting Hotline Miami 1 and 2 from a propietary engine (GameMaker), without source access to platforms the engine does not support.
Presentation of the paper "Verification of Relational Data-Centric Dynamic Systems with External Services" at the 32nd ACM SIGACT SIGMOD SIGART Symposium on Principles of Database Systems (PODS 2013)
Free Lunch is Over: Why is C++ so Important in the Modern World?Mateusz Pusz
"Don’t pay for what you don’t use" and "Don't leave room for a language below C++ (except assembler)" are the C++ design and evolution priorities that have stuck with us since the beginning of the programming language. CPU clock frequencies stopped growing more than 10 years ago, and since that time, our processor cores are no longer accelerating. Moreover, the demand for power savings is higher than ever for both small factor devices, like mobile phones, and for huge factor server farms. In the domains where each CPU cycle counts, C++ is the fastest and the most robust solution on the market. C++ programming language is evolving faster now than ever before — and EPAM is an active contributor to this transformation. This talk will briefly summarize the history of C++, describe the benefits of the programming language, highlight the business domains where its usage is essential, and provide some insights on the future of the language and its standardization process.
A Physical Units Library for the Next C++Mateusz Pusz
These are the slides from my CppCon 2020 talk. You can find the recording here: https://www.youtube.com/watch?v=7dExYGSOJzo. All my other talks can be found here: https://train-it.eu/resources.
---
During CppCon 2019 Mateusz provided an overview of current solutions on the market as well as challenges of implementing a modern C++ physical units library. This year's talk will focus on 'mp-units', the library that was developed by Mateusz and contributors, and which is proposed for C++ standardization. During the tutorial, we will get familiar with the building blocks of the library's framework and its most important concepts. Numerous code examples will present how to use and solve real-life problems with the library. The audience will learn how easy it is to extend it with new units, dimensions, or even whole new systems of quantities. Last but not least Mateusz will provide a fair comparison of how well this library performs in comparison to other products on the market.
These are the slides from my keynote talk on C++ on CoreHard Autumn 2019. You can find the recording here: https://www.youtube.com/watch?v=nqf53MlnMpo. All my other talks can be found here: https://train-it.eu/resources.
---
That talk will present the C++ world seen from Low Latency domain. The world where no dynamic allocations are welcomed, C++ exceptions are nearly not used, where STL containers are often not enough, and where developers often need to go deep down to assembly level to verify if the code really does its best.
Rethinking the Way We do Templates in C++Mateusz Pusz
These are the slides from my CppCon 2019 talk. You can find the recording here: https://www.youtube.com/watch?v=oNBnYhLxlTU. All my other talks can be found here: https://train-it.eu/resources.
---
Template metaprogramming is hard. In case it is hard only for the library implementer then it is not that bad. The problem arises when it also affects the users of this library.
This talk is summarizing my experience and thoughts gathered during the implementation of the Physical Units Library for C++. The way we do template metaprogramming now results with inscrutable compile-time errors and really long type names observed while debugging our code. That is mostly caused by aliasing class template specializations of non-trivial metaprogramming interface designs. Compilation times of such code also leave a lot of room for improvement, and the practices we chose to use in the Standard Library are often suboptimal. Taking into account the Rule of Chiel while designing templated code makes a huge difference in the compile times. This talk presents a few simple examples (including the practices from the C++ Standard Library) of achieving the same goal in different ways and provides benchmark results of time needed to compile such source code.
These are the slides from my talk on C++ London meetup. You can find the recording here: https://www.youtube.com/watch?v=HsC1EoFjf8U. All my other talks can be found here: https://train-it.eu/resources.
---
C++ is the fastest programming language in the world, and it leaves no room for other languages below it (except assembler). That is why it gets more attention now than ever before. As a result, we observe an increasing speed of C++ language evolution. C++11 was a game changer, but is now considered an "old" language already. C++14 & 17 provided many improvements that allow us to write portable, safer, and faster code in a shorter time. The resulting source code is easier to reason about and maintain. Moreover, C++20 is coming soon, and it is going to be a game changer again.
In my talk, I provide a few typical legacy code examples that most of us write every day. I describe how those samples evolve with the changes introduced in the each C++ language release from C++11 up to the major groundbreaking features of the upcoming C++20. During the talk, the audience will learn how much easier, more robust, and safer is the code written using modern tools that we get with every new C++ release.
Implementing a Physical Units Library for C++Mateusz Pusz
These are the slides from my keynote talk on C++ on CoreHard Spring 2019. You can find the recording here: https://www.youtube.com/watch?v=hcgL8QBmh2I. All my other talks can be found here: https://train-it.eu/resources.
---
This talk will present the current state of my work on designing and implementing Physical Units Library for C++. I will present all the challenges, design tradeoffs, and potential solutions to those problems. During the lecture, we will also see how new C++20 features help to make the library interface easier to use, maintain, and extend. Among others, we will see how we can benefit from class types provided as non-type template parameters, how new class template argument deduction rules simplify the interfaces and the full power of using concepts to constrain template types.
Implementing Physical Units Library for C++Mateusz Pusz
These are the slides from my 4Developers 2019 talk. You can find the recording here: https://www.youtube.com/watch?v=O1vlFZcaMKo. All my other talks can be found here: https://train-it.eu/resources.
---
This talk will present the current state of my work on designing and implementing Physical Units Library for C++. I will present all the challenges, design tradeoffs, and potential solutions to those problems. During the lecture, we will also see how new C++20 features help to make the library interface easier to use, maintain, and extend. Among others, we will see how we can benefit from class types provided as non-type template parameters, how new class template argument deduction rules simplify the interfaces, and a full power of using concepts to constrain template types.
C++ Concepts and Ranges - How to use them?Mateusz Pusz
These are the slides from my Meeting C++ 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=pe05ZWdh0N0. All my other talks can be found here: https://train-it.eu/resources.
---
The most of the Concepts TS and Ranges TS is merged into the C++20 standard draft document. The talk will present a current design of those features and will provide suggestions on how to use them in our source code. That presentation is meant to inspire discussion on how should we use those long-awaited features while building tools and the C++ Standard Library.
Git, CMake, Conan - How to ship and reuse our C++ projects?Mateusz Pusz
These are the slides from my CppCon 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=S4QSKLXdTtA. All my other talks can be found here: https://train-it.eu/resources.
---
Git and CMake are already established standards in our community. However, it is uncommon to see them being used in an efficient way. As a result, many C++ projects have big problems with either importing other dependencies or making themselves easy to import by others. It gets even worse when we need to build many different configurations of our package on one machine.
That presentation lists and addresses the problems of build system and packaging that we have with large, multi-platform, C++ projects that often have many external and internal dependencies. The talk will present how proper use of CMake and Conan package manager can address those use cases. It will also describe current issues with the cooperation of those tools.
If you've attended or seen my talk at C++Now 2018, that time you can expect much more information on Conan and package creation using that tool. I will also describe how the integration of CMake and Conan changed over the last few months.
These are the slides from my C++Now 2018 talk. You can find the recording here: https://www.youtube.com/watch?v=y7PBciQp0B8. All my other talks can be found here: https://train-it.eu/resources.
---
Presentation of features already voted into C++20 Standard Draft in Toronto, Albuquerque, and Jacksonville ISO C++ Committee Meetings as well as the overview of other really promising proposals that have high chances to arrive in C++20.
Pointless Pointers - How to make our interfaces efficient?Mateusz Pusz
These are the slides from my code::dive 2017 talk. You can find the recording here: https://www.youtube.com/watch?v=qrifyjQW9gA. All my other talks can be found here: https://train-it.eu/resources.
---
C++ is not C. C++ developers too often forget about that. The effects are often disastrous. nullptr dereferences, buffer overflows, resource leaks are the problems often seen in C++ applications bug trackers. Does it have to be like that? The talk presents a few simple rules tested in production that will make most of those issues go away and never appear again in the C++ software. Interested? Come and see :-)
These are the slides from my 4Developers 2017 talk. You can find the recording here: https://www.youtube.com/watch?v=pU0VRMqM5vs. All my other talks can be found here: https://train-it.eu/resources.
---
That talk will present the C++ world seen from Low Latency domain. The world where no dynamic allocations are welcomed, C++ exceptions are nearly not used, where STL containers are often not enough, and where developers often need to go deep down to assembly level to verify if the code really does its best.
These are the slides from my code::dive 2016 talk. You can find the recording here: https://www.youtube.com/watch?v=yCfFt061SU4. All my other talks can be found here: https://train-it.eu/resources.
---
Writing fast C++ applications is a really complex subject. It often turns out that deep but isolated knowledge of ISO C++ standard and algorithmic complexity of operations does not guarantee the success. Often the bottleneck of our applications happens to be the performance of computer’s memory or its wrong usage by our code. The lack of knowledge in that subject can ruin all our ambitions to create high performance implementation.
std::shared_ptr<T> - (not so) Smart hammer for every pointy nailMateusz Pusz
These are the slides from my code::dive 2016 talk. You can find the recording here: https://www.youtube.com/watch?v=hHQS-Q7aMzg. All my other talks can be found here: https://train-it.eu/resources.
---
C++ rule of thumb is “you do not pay for what you do not use”. However, it turns out that this is not the case for some of the utilities from the C++ Standard Library. The key example here is the favorite tool of many developers – std::shared_ptr. The talk will describe the problems related to it in detail. It will also try to answer the question how it was possible to avoid them.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
3. • Time required to perform some action or to produce some result
• Measured in units of time like hours, minutes, seconds, nanoseconds or clock periods
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
WHY?
LATENCY
3
4. • Time required to perform some action or to produce some result
• Measured in units of time like hours, minutes, seconds, nanoseconds or clock periods
• In capital markets, the use of algorithmic trading to react to market events faster than the competition
to increase profitability of trades
• Many use cases where predictability of latency in message delivery is just as important, if not more
important than achieving a low average latency
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
WHY?
LATENCY
LOW LATENCY
3
5. • In Low Latency system we care a lot about
WCET (Worst Case Execution Time)
• In order to limit WCET we should limit the
usage of specific C++ language features
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
HOW NOT TO DEVELOP SOFTWARE THAT HAVE PREDICTABLE
PERFORMANCE?
4
6. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
7. • C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
8. • C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
• Throwing exceptions on likely code path
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
9. • C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
• Throwing exceptions on likely code path
• Dynamic polymorphism
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
10. • C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
• Throwing exceptions on likely code path
• Dynamic polymorphism
• Multiple inheritance
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
11. • C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
• Throwing exceptions on likely code path
• Dynamic polymorphism
• Multiple inheritance
• RTTI
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
12. • C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
• Throwing exceptions on likely code path
• Dynamic polymorphism
• Multiple inheritance
• RTTI
• Dynamic memory allocations
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
5
13. • Dynamic polymorphism
• Dynamic memory allocations
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THINGS TO AVOID ON THE FAST PATH
• C++ tools that trade performance for usability (e.g. std::shared_ptr, std::function)
• Throwing exceptions on likely code path
• Multiple inheritance
• RTTI
6
15. class base : noncopyable {
public:
virtual ~base() = default;
virtual void foo() = 0;
};
class x : public base {
public:
void foo() override;
};
class y : public base {
public:
void foo() override;
};
std::unique_ptr<base> b = std::make_unique<x>();
b->foo();
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
HOW?
DYNAMIC POLYMORPHISM
8
16. class base : noncopyable {
public:
virtual ~base() = default;
virtual void foo() = 0;
};
class x : public base {
public:
void foo() override;
};
class y : public base {
public:
void foo() override;
};
std::unique_ptr<base> b = std::make_unique<x>();
b->foo();
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
HOW?
DYNAMIC POLYMORPHISM
8
17. class base : noncopyable {
public:
virtual ~base() = default;
virtual void foo() = 0;
};
class x : public base {
public:
void foo() override;
};
class y : public base {
public:
void foo() override;
};
struct x { void foo(); };
struct y { void foo(); };
std::variant<x, y> b;
std::visit([](auto&& v){ v.foo(); }, b);
• Shorter
• Faster
• Value semantics
• Works on unrelated classes
• More flexible thanks to duck typing
std::unique_ptr<base> b = std::make_unique<x>();
b->foo();
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
HOW?
DYNAMIC POLYMORPHISM VARIANT
8
20. Abstract machine that can be in exactly one of a finite number of
states at any given time.
-- Wikipedia
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
FINITE STATE MACHINE
11
21. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
FINITE STATE MACHINE
12
22. • State changes to another in a response to
some external inputs called events
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
FINITE STATE MACHINE
12
23. • State changes to another in a response to
some external inputs called events
• The change from one state to another is
called a transition
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
FINITE STATE MACHINE
12
24. • State changes to another in a response to
some external inputs called events
• The change from one state to another is
called a transition
• A FSM is defined by
– a list of states
– its initial state
– the conditions for each transition
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
FINITE STATE MACHINE
12
26. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
CLASS DIAGRAM
14
27. template<typename Event>
class state : noncopyable {
public:
virtual ~state() = default;
virtual std::unique_ptr<state> on_event(Event) = 0;
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
15
28. template<typename Event>
class state : noncopyable {
public:
virtual ~state() = default;
virtual std::unique_ptr<state> on_event(Event) = 0;
};
template<typename Event>
class fsm {
std::unique_ptr<state<Event>> state_;
public:
explicit fsm(std::unique_ptr<state<Event>> state) : state_(std::move(state)) {}
void dispatch(Event e)
{
auto new_state = state_->on_event(e);
if (new_state)
state_ = std::move(new_state);
}
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
15
29. template<typename Event>
class state : noncopyable {
public:
virtual ~state() = default;
virtual std::unique_ptr<state> on_event(Event) = 0;
};
template<typename Event>
class fsm {
std::unique_ptr<state<Event>> state_;
public:
explicit fsm(std::unique_ptr<state<Event>> state) : state_(std::move(state)) {}
void dispatch(Event e)
{
auto new_state = state_->on_event(e);
if (new_state)
state_ = std::move(new_state);
}
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
16
30. class connection_fsm : public fsm<event> {
public:
connection_fsm():
fsm<event>(std::make_unique<state_idle>()) {}
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
CONNECTION FSM
17
31. class connection_fsm : public fsm<event> {
public:
connection_fsm():
fsm<event>(std::make_unique<state_idle>()) {}
};
using s = state<event>;
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
CONNECTION FSM
17
32. class connection_fsm : public fsm<event> {
public:
connection_fsm():
fsm<event>(std::make_unique<state_idle>()) {}
};
using s = state<event>;
class state_idle final : public s {
public:
std::unique_ptr<s> on_event(event e) override;
};
class state_connecting final : public s {
static constexpr int n_max = 3;
int n = 0;
public:
std::unique_ptr<s> on_event(event e) override;
};
class state_connected final : public s {
public:
std::unique_ptr<s> on_event(event e) override;
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
CONNECTION FSM
17
40. • Open to new alternatives
– new derived types may be added by clients at any point of time (long a er base class
implementation is finished)
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
21
41. • Open to new alternatives
– new derived types may be added by clients at any point of time (long a er base class
implementation is finished)
• Closed to new operations
– clients cannot add new operations to dynamic dispatch
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
21
42. • Open to new alternatives
– new derived types may be added by clients at any point of time (long a er base class
implementation is finished)
• Closed to new operations
– clients cannot add new operations to dynamic dispatch
• Multi-level
– many levels of inheritance possible
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
21
43. • Open to new alternatives
– new derived types may be added by clients at any point of time (long a er base class
implementation is finished)
• Closed to new operations
– clients cannot add new operations to dynamic dispatch
• Multi-level
– many levels of inheritance possible
• Object Oriented
– whole framework is based on objects
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
SINGLE DYNAMIC DISPATCH
21
45. class event : noncopyable {
public:
virtual ~event() = default;
};
class event_connect final : public event {
std::string_view address_;
public:
explicit event_connect(std::string_view address): address_(address) {}
std::string_view address() const { return address_; }
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
WHAT IF WE WANT OUR EVENTS TO PASS DATA?
23
46. class event : noncopyable {
public:
virtual ~event() = default;
};
class event_connect final : public event {
std::string_view address_;
public:
explicit event_connect(std::string_view address): address_(address) {}
std::string_view address() const { return address_; }
};
std::unique_ptr<state> state_idle::on_event(const event& e)
{
if(auto ptr = dynamic_cast<const event_connect*>(&e)) { /* ... */ }
else { /* ... */ }
}
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
WHAT IF WE WANT OUR EVENTS TO PASS DATA?
23
47. class event : noncopyable {
public:
virtual ~event() = default;
};
class event_connect final : public event {
std::string_view address_;
public:
explicit event_connect(std::string_view address): address_(address) {}
std::string_view address() const { return address_; }
};
std::unique_ptr<state> state_idle::on_event(const event& e)
{
if(auto ptr = dynamic_cast<const event_connect*>(&e)) { /* ... */ }
else { /* ... */ }
}
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
WHAT IF WE WANT OUR EVENTS TO PASS DATA?
A really bad idea :-(
23
48. Special form of multiple dispatch, and a mechanism that
dispatches a function call to di erent concrete functions
depending on the runtime types of two objects involved in the call
-- Wikipedia
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
DOUBLE DISPATCH (AKA VISITOR PATTERN)
24
67. template<typename Fsm, typename... Events>
void dispatch(Fsm& fsm, const Events&... events)
{
(fsm.dispatch(*events), ...);
}
dispatch(fsm,
std::make_unique<event_connect>("train-it.eu"),
std::make_unique<event_timeout>(),
std::make_unique<event_connected>(),
std::make_unique<event_disconnect>());
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
THE SLOW PART
35
68. • Open to new alternatives
• Closed to new alternatives
– one of class hierarchies fixed at design time and cannot be extended by clients
• Closed to new operations
– clients cannot add new operations to dynamic dispatch
• Multi-level
– many levels of inheritance possible
• Object Oriented
– whole framework is based on objects
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
DOUBLE DYNAMIC DISPATCH (AKA VISITOR PATTERN)
36
70. template<class... Types>
class variant;
• Represents a type-safe union
• At any given point in time either
– holds a value of one of its alternative types
– is in special valueless_by_exception state (reached if an exception is thrown during contained
value initialization or assignment)
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...>
38
71. // not a valid C++
template<typename Type1, typename Type2, typename Type3...>
class variant {
union options {
Type1 t1;
Type2 t2;
Type3 t3;
...
};
int index_;
public:
variant();
template<class T> variant(T&& t);
template<class T, class... Args> variant(std::in_place_type_t<T>, Args&&... args);
std::size_t index() const;
//...
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> INTERFACE (SIMPLIFICATION)
39
72. • Not allowed to allocate dynamic memory
• Not permitted to hold references, arrays, or void
• Empty variants are ill-formed (std::variant<std::monostate> can be used instead)
• Permitted to hold the same type more than once, and to hold di erently cv-qualified versions of the
same type
• Default-initialized variant holds a value of its first alternative unless that alternative is not default-
constructible
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...>
40
92. template<typename Derived, typename StateVariant>
class fsm {
StateVariant state_;
public:
template<typename Event>
void dispatch(Event&& event)
{
Derived& child = static_cast<Derived&>(*this);
auto new_state = std::visit(
[&](auto& s) -> std::optional<StateVariant>
{ return child.on_event(s, std::forward<Event>(event)); },
state_);
if(new_state)
state_ = *std::move(new_state);
}
};
• Variant of events not needed anymore
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
FSM ENGINE
52
93. class connection_fsm
: public fsm<connection_fsm, state> {
public:
auto on_event(state_idle&,
const event_connect& e)
{ }
auto on_event(state_connecting&,
const event_connected&)
{ }
auto on_event(state_connecting& s,
const event_timeout&)
{
}
auto on_event(state_connected&,
const event_disconnect&)
{ }
template<typename State, typename Event>
auto on_event(State&, const Event&)
{ }
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
TRANSITIONS DEFINED BY THE FSM ITSELF
53
94. class connection_fsm
: public fsm<connection_fsm, state> {
public:
auto on_event(state_idle&,
const event_connect& e)
{ return state_connecting{std::string(e.address)}; }
auto on_event(state_connecting&,
const event_connected&)
{ return state_connected{}; }
auto on_event(state_connecting& s,
const event_timeout&)
{
return ++s.n < state_connecting::n_max ?
std::nullopt : std::optional<state>(state_idle{});
}
auto on_event(state_connected&,
const event_disconnect&)
{ return state_idle{}; }
template<typename State, typename Event>
auto on_event(State&, const Event&)
{ return std::nullopt; }
};
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
TRANSITIONS DEFINED BY THE FSM ITSELF
53
95. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
CLASS DIAGRAM
54
103. CLOSED(Start)
LISTEN/-
CLOSE/-
LISTEN
SYN
RECEIVED
SYN
SENT
CONNECT/ (Step 1 of the 3-way-handshake)SYN
SYN/SYN+ACK(Step 2 of the 3-way-handshake)
unusual event
client/receiver path
server/sender path
RST/-
SYN/SYN+ACK (simultaneous open)
SYN+ACK/ACK
(Step 3 of the 3-way-handshake)
Data exchange occurs
ESTABLISHED
FIN/ACK
ACK/-
CLOSE/-
SEND/SYN
CLOSE/FIN
CLOSE/FIN
CLOSING
TIME WAIT
CLOSED
FIN WAIT 1
FIN WAIT 2
CLOSE WAIT
LAST ACK
CLOSE/FIN
FIN/ACK
FIN+ACK/ACK
ACK/-
FIN/ACK
Timeout
(Go back to start)
Active CLOSE Passive CLOSE
ACK/-
ACK/-
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
TCP STATE DIAGRAM
61
104. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
TCP FSM PERFORMANCE
62
105. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
TCP FSM PERFORMANCE
62
106. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
TCP FSM PERFORMANCE
62
108. CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
109. • Open/Closed to new alternatives • Closed to new alternatives
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
110. • Open/Closed to new alternatives
• Closed to new operations
• Closed to new alternatives
• Open to new operations
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
111. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• Closed to new alternatives
• Open to new operations
• Single level
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
112. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
113. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Pointer semantics
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
• Value semantics
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
114. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Pointer semantics
• Design forced by the implementation details
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
• Value semantics
• Many design choices possible
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
115. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Pointer semantics
• Design forced by the implementation details
• Forces dynamic memory allocations
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
• Value semantics
• Many design choices possible
• No dynamic memory allocations
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
116. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Pointer semantics
• Design forced by the implementation details
• Forces dynamic memory allocations
• Strict interfaces
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
• Value semantics
• Many design choices possible
• No dynamic memory allocations
• Duck typing
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
117. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Pointer semantics
• Design forced by the implementation details
• Forces dynamic memory allocations
• Strict interfaces
• Complex
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
• Value semantics
• Many design choices possible
• No dynamic memory allocations
• Duck typing
• Simple
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64
118. • Open/Closed to new alternatives
• Closed to new operations
• Multi-level
• OO
• Pointer semantics
• Design forced by the implementation details
• Forces dynamic memory allocations
• Strict interfaces
• Complex
• Slower
• Closed to new alternatives
• Open to new operations
• Single level
• Functional
• Value semantics
• Many design choices possible
• No dynamic memory allocations
• Duck typing
• Simple
• Faster
CppCon 2018 | E ective replacement of dynamic polymorphism with std::variant
std::variant<Types...> VS INHERITANCE
INHERITANCE VARIANT
64