Best Practices for C++ Smart Pointers
When to use each pointer type in C++ application design
Smart pointers are part of modern C++ (from C++11
) and can make expressing memory ownership in an application much clearer, but only if you take the time to understand how and where to use each of them.
Let’s explore current best practices for modern C++ smart pointer usage.
Disabling CPU Scaling when Profiling Code
Producing consistent results when measuring the performance of C++ in Linux
It’s often necessary to disable the CPU Scaling feature on a system when doing performance measurement in C++.
Here’s how to do it on Linux.
C++ Lambdas Are Just Syntactic Sugar for Functors
Demystifying the correlation between lambda expressions and functors
If you’re anything like me, you’ve probably heard about functors, and maybe even can describe what they are. You’ve almost certainly used lambda expressions in C++. Perhaps you’ve even heard that lambda expressions are functors. Did you know that under the hood, lambdas are just anonymous functors?
Simplifying a C++ Template with Concepts
Improving a previously created template with concepts
A few readers mentioned that they would use C++ Concepts (available in C++20
) to accomplish the same thing as the previous example where we excluded the general case of a template by using partial specialization.
In this C++ code snippet, we’ll do just that.
Template Specialization in C++ Without a General Case
How to be very specific with template specializations, omitting the generic case
Template specialization in C++ is a way of describing to the compiler an explicit case of a template, given specific template arguments. For example, if you have a generic template that takes a type T
, you can describe a specialization that outlines how the template works for a specific type passed as T
: eg, an int
or float
.
Sometimes, we may only want a specific subset of specializations, and to exclude the general template case.
Low Latency C++ for HFT - Part 3 - Network Programming
Low-latency TCP and UDP networking with Unix sockets
This third third part of the low-latency C++ series is all about network programming! In this article, I put together some utilities for working with TCP and UDP networking sockets in Unix. A high speed non-blocking TCP server module as well as utilities for working with UDP multicast are built.
Low Latency C++ for HFT - Part 2 - Building Blocks
Building some core modules needed for low-latency systems programming
The second part in a series documenting my learning adventure while developing a low-latency high frequency trading (HFT) application in C++.
In this part, I begin writing some code and developing some of the initial building blocks needed for the HFT system.
Low Latency C++ for HFT - Part 1 - Introduction
The first in a series documenting my learnings while developing a low-latency, performant C++ application for High Frequency Trading
This series will be documenting my learning adventures as I delve deep into the world of ultra low-latency, high performance C++. Along the way, I’ll be building a High Frequency Trading (HFT) system from scratch.
While much of this information will be specific to HFT, it can apply to any system which demands deterministic low latency, or operates within tight resource constraints (eg: embedded systems).
Deploying RateMyDerp to Production
Deploying a production-grade Django/Python web application on Linux
This article details the deployment of a production-grade Django/Python web application to a “bare metal” Linux VM.
To gain the most experience possible, we are not using a PaaS or docker-based deployment. Instead, we will spin up an Ubuntu virtual machine and configure everything, including postgres database, redis and any required systemd service units that manage the services needed to run the application.