Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » quiz   (RSS)

Performance Quiz #13 -- Linq to SQL compiled query cost -- solution

Well is there really a "solution" at all in general? This particular case I think I constrained enough that you can claim an answer but does it generalize? Let's look at what I got first, the raw results are pretty easy to understand. The experiment I
Posted by ricom | 15 Comments
Filed under: , ,

Performance Quiz #13 -- Linq to SQL compiled queries cost

I've written a few articles about Linq now and you know I was a big fan of compiled queries in Linq but what do they cost? Or more specifically, how many times to you have to use a compiled query in order for the cost of compilation to pay for itself?
Posted by ricom | 27 Comments
Filed under: , ,

Performance Quiz #12 -- The Cost of a Good Hash -- Solution

Well once again there have been many thoughtful replies to both the original question as well as the followup with hints. Recall the original question asked a bit of trivia: could you name 5 implementations of GetHashCode in the framework that do things you might not expect to see in a hash function? It's a little bit of a vague question and also requires a good deal of arcane knowledge of the CLR. The most interesting thing about the discussion I think is just what people considered "unusual." But as always there was a method to my madness. So without further ado here's my list of "unusual" hash functions, there are 53 of them.
Posted by ricom | 6 Comments
Filed under: ,

Performance Quiz #12 -- The Cost of a Good Hash -- Some Help

I continue to be astounded by what my readers can come up with. As usual I had a purpose for posing my last question and that purpose was to show that basically its hard to get a handle on what things cost in any kind of omnibus way. But imagine my surprise
Posted by ricom | 32 Comments
Filed under: , ,

Performance Quiz #12 -- The Cost of a Good Hash

This quiz is a little bit different than some of my others. Here is System.String.GetHashCode public override unsafe int GetHashCode() { fixed (char* text1 = ((char*) this)) { char* chPtr1 = text1; int num1 = 0x15051505; int num2 = num1; int* numPtr1
Posted by ricom | 28 Comments
Filed under: ,

Performance Quiz #11: Ten Questions on Value-Based Programming : Solution

In my last quiz I asked a few questions about a few hypothetical classes that might appear in a value-rich context. I styled my example in the form of some graphics library classes but the idea is a general one. Many contexts can and should be rich in
Posted by ricom | 11 Comments
Filed under: ,

Performance Quiz #11: Ten Questions on Value-Based Programming

Some of you have probably heard one or more of my talks, or read the annotations I made in the Design Guidelines . If you have then you already know that I don't always agree with every suggested guideline. Especially not in every context. It's probably
Posted by ricom | 22 Comments
Filed under: ,

Performance Quiz #10 -- Thread local storage -- Solution

I actually posted quiz #10 quite a while ago but a comment with the correct solution came in so quickly that I wasn't very motivated to post a followup. There are excellent links in the comments (thank you readers!) But now I'll have to make the quizzes
Posted by ricom | 6 Comments
Filed under: ,

Performance Quiz #10 -- Thread local storage

It's time for another quiz! A very short one this time. If I need some thread local storage and I might need several entries should I use: Thread.GetData(slot) and Thread.SetData(slot, object) or should I make my own static member like this [ThreadStatic]
Posted by ricom | 8 Comments
Filed under: ,

Performance Quiz #9 -- extra innings due to dispatch stubs

Well you'll recall that in the Performance Quiz #9 solution there was a surprising result where Test7 was actually faster than Test5 even though they appear to be doing basically exactly the same work. So my new challenge to you was to see if you can
Posted by ricom | 1 Comments
Filed under: ,

Performance Quiz #9 : IList<T> List and array speed -- solution

Last week I posted Performance Quiz #9 for discussion. Well the comments have been just awesome and many people went right ahead and measured the results. Some of you have discovered the key point in this particular test: Arrays are magic. In the test
Posted by ricom | 8 Comments
Filed under: ,

Attachment(s): Program.cs

Performance Quiz #9 : IList<T> List and array speed

A short and sweet quiz with lots of juicy discussion possibilities: public int Sum( IList < ushort > indices) { int result = 0; for ( int i = 0; i < indices.Count; i++) result += indices[i]; return result; } Considering only the time it takes
Posted by ricom | 34 Comments
Filed under: ,

Performance Quiz #8 -- The problems with parsing -- Part 5

And today we conclude our little saga with one final experiment, a little analysis and some comments. I hope you've enjoyed reading this series as much as I've enjoyed doing the experiments. First, as promised I created yet another version of this little
Posted by ricom | 6 Comments
Filed under: ,

Performance Quiz #8 -- The problems with parsing -- Part 4

In my last posting I made some recommendations about how to drastically improve the evaluation process based on the key observations that even the basic operations required to evaluate the truth of the facts were quite costly -- more so than all of the
Posted by ricom | 5 Comments
Filed under: ,

Performance Quiz #8 -- The problems with parsing -- Part 3

The thing about performance work is that it's very easy to be fooled into looking into the wrong areas. That's why you want your changes to be firmly grounded in data whenever they can be. Or if you're planning, you want to be thinking about what your
Posted by ricom | 8 Comments
Filed under: ,
More Posts Next page »
 
Page view tracker