Profile cover photo
Profile photo
Tom DuPont
120 followers -
I'm a tool so you don't have to be.
I'm a tool so you don't have to be.

120 followers
About
Posts

Post has attachment
I love that .NET has so many useful utilities available in the base framework. I often use the SemaphoreSlim, and I love that it supports async await. However, I don't like always having to create a try finally block around every use call to ensure that the release method gets called.
Add a comment...

Post has attachment
An implementation of a ConcurrentQueue that supports taking a lambda and thread count to asynchronously process enqueued items.
Add a comment...

Post has attachment
In my previous blog post, I talked about Optimizing Dynamic Method Invokes in .NET. In this post, we will use that information to create a static helper method that is twice as fast as MethodInfo.Invoke. Basically, we create and cache a delegate in a concurrent dictionary, and then cast both it and it's arguments to dynamics and invoke them directly.
Add a comment...

Post has attachment
Recently I need to balance getting resources from a restricted number of sources. To do this I created a generic IResourceLoader interface, and made two implementations: one to wrap a semaphore, and the other to wrap and balance a collection of IResourceLoaders. Below is the implementation, complete with unit tests; let's take a look!
Add a comment...

Post has attachment
I recently had a lot of fun helping to optimize some RPC code that was using reflection to dynamically invoke methods in a C# application. Below are a list of implementations that we experimented with, and their performance. Spoilers, here are the results...
Add a comment...

Post has attachment
Add a comment...

Post has attachment
Add a comment...

Post has attachment
This is the second time this week where I have had to ask myself "how did I not know about this?" There is a regex character to identify word boundaries: \b This is a zero length match, similar to the caret and dollar sign. It finds the boundaries between words, allowing you to search for a whole word match.
Add a comment...

Post has attachment
There is great question on Stack Overflow about caching a jquery ajax response in javascript/browser. Unfortunately, even thought it was a good solution, it did not do quite what I needed it to. The application I was trying to optimize sometimes made redundant parallel requests, and I needed my caching solution to include a queuing system to prevent duplicate fetches.
Add a comment...

Post has attachment
What data structure do you use when you need to efficiently check if a number is within a large set of ranges? If you require that the ranges do not overlap, then it is simple to keep a balanced binary tree of the ranges.
Add a comment...
Wait while more posts are being loaded