Today we’ll begin exploring the C++ Standard Library. As C++ is mostly a superset of C, the C++ Standard Library is mostly a superset of the C Standard Library. So we’ll begin there!
Posts Tagged string
A couple years ago, I wrote an article showing how to empower game designers with the ability to write simple formulas like
PlayerLevel*100+100. These are much more useful than just constants and don’t require any of the complexity of a real programming language. Today we’ll bring it into the Burst-compatible world and also improve its ability to handle more complex formulas.
Unity’s Burst compiler imposes an interesting subset of C#. The “no managed objects” rule of thumb is not always correct. Today we’ll look at eExceptions, which are managed objects but are partially supported by Burst. What’s allowed and what’s banned? Read on to find out.
IL2CPP can really slow our code down sometimes, and not just for esoteric features. Calling common math and string functions can be dramatically slower in IL2CPP. Today’s article shows you how you can work around this to speed them back up.
The story usually has three parts. First, find the highest CPU cost functions in a profiler. Second, look at the corresponding C++ code that IL2CPP generated from C#. Third, stop using more parts of C#. Today’s article explores some more IL2CPP output and discovers some more areas of C# that are shockingly expensive to use.
We’ve been able to call methods since the very beginning, but we’ve always had to pass all the parameters. Today we’ll add support for default parameters so you can skip them sometimes. There’s a surprising amount of detail involved with this, so read on to learn some caveats of C#, .NET, and C++.
Sometimes it seems like Unity programming is a minefield. Plenty of innocuous-looking code secretly creates garbage and eventually the GC runs and causes a frame hitch. Today’s article is about some of those less-obvious ways to create garbage.
As programmers, we concatenate strings all the time. Should we worry about the performance? How about the amount of garbage we’re producing for the garbage collector? Today’s article runs a quick test to find out!
What’s the fastest way to build a
string in C#? We have several options available to us.
string.Format() is a function built right in to the
string class., Concatenation (
"a" + "b") is a feature of the language itself! The
System.Text.StringBuilder class is a built in class with a name that makes it sound like it’s purpose-built for building strings. Today I pit these three against each other to find out just which one you should be using to build strings as quickly as possible.