Ben Bowen's Blog
• Home / Blog •
• About •
• Subscribe •
Categories
All
Software Engineering
Game Design
Personal
Software Engineering Tags
c#
22 posts
multithreading
4 posts
native interop
1 posts
.net
14 posts
oop / api design
1 posts
performance
8 posts
Software Engineering posts tagged with 'Performance'
Topics relating to writing code that performs faster than naive implementations.
Postmortems - Clearly Too Slow
// An example of a simple everyday operation that needed micro-optimising in my game engine
Software Engineering
• Wednesday 24th May 2017
performance
c#
In my game engine, the following code was called once every frame for every material in the game. We had an average of about 500 materials in most scenes; so on a high-end machine this one function was being called about
100,000 times a second
. C# can definitely handle it (ask any high-scale web developer), but as you can imagine the method had to be fast (especially as we wanted to support average-to-low-end desktops):...
Common Multithreading Mistakes in C# - IV: Everything Else
// A look at some miscellaneous unexpected gotchas when writing multithreaded code
Software Engineering
• Sunday 23rd April 2017
multithreading
performance
c#
In this series, I'm going to be elucidating some common errors C# programmers make when working with multithreaded systems. I'll be exploring issues from a lower-level point-of-view, and not dabbling too much in higher-level abstractions and libraries (such as the TPL and similar); hopefully the points raised will be pertinent to anyone hoping to write concurrent or parallelized applications....
Common Multithreading Mistakes in C# - III: Unsafe Assumptions
// An in-depth look at exactly what the CPU and runtime can do to subvert us when we don't write properly thread-safe code
Software Engineering
• Saturday 11th February 2017
multithreading
performance
c#
In this series, I'm going to be elucidating some common errors C# programmers make when working with multithreaded systems. I'll be exploring issues from a lower-level point-of-view, and not dabbling too much in higher-level abstractions and libraries (such as the TPL and similar); hopefully the points raised will be pertinent to anyone hoping to write concurrent or parallelized applications....
Common Multithreading Mistakes in C# - II: Unnecessary Contention
// Exploring the basics of what makes different approaches to parallelism more or less efficient
Software Engineering
• Friday 14th October 2016
multithreading
performance
c#
In this series, I'm going to be elucidating some common errors C# programmers make when working with multithreaded systems. I'll be exploring issues from a lower-level point-of-view, and not dabbling too much in higher-level abstractions and libraries (such as the TPL and similar); hopefully the points raised will be pertinent to anyone hoping to write concurrent or parallelized applications....
Common Multithreading Mistakes in C# - I: Incorrect Granularity
// A higher-level overview of the lock keyword and how it is commonly misused
Software Engineering
• Sunday 3rd July 2016
multithreading
performance
c#
In this series, I'm going to be elucidating some common errors C# programmers make when working with multithreaded systems. I'll be exploring issues from a lower-level point-of-view, and not dabbling too much in higher-level abstractions and libraries (such as the TPL and similar); hopefully the points raised will be pertinent to anyone hoping to write concurrent or parallelized applications....
Fun With __makeref
// Explanation on how to use hidden C# keywords to implement generic pointers and related functions
Software Engineering
• Friday 13th May 2016
performance
c#
C#'s list of keywords is ever-growing, but there is also a set of four hidden (dark) keywords that have been in the language since its earliest days that not so many people are aware of. Those keywords are: Today we'll be looking at
__makeref
and its two companion keywords
__reftype
and
__refvalue
. We won't be looking at
__arglist
today....
Three Garbage Examples
// Three examples and explanations of situations that can create unnecessary garbage in .NET4/C#5
Software Engineering
• Friday 8th April 2016
performance
.net
c#
C# (and any language that runs on the CLR) is a garbage-collected language, meaning that objects that have no references to them remaining will have their memory reclaimed at some point in the future. Creating too much garbage (by creating too many ephemeral objects or over-using the
new
keyword) can induce the garbage-collector too frequently, slowing down the entire application....
P/Invoke Tips
// Assorted accrued tips on using P/Invoke in C#
Software Engineering
• Monday 18th January 2016
native interop
performance
.net
c#
Not very many C# programmers will ever need to do much with P/Invoke (Microsoft's technology for interoperation with legacy or native codebases), but for those of us who do, I've amassed a few little tips that aren't always included in the various tutorials found on the 'net....