What's coming in Paint.NET v3.5.5: Performance!

There won’t be any new features this time around, of course, since it’s just a +0.0.1 release. There’s only 1 bug that I’ve found which I’ve decided to fix, which has to do with saving “large” 8-bit PNG/GIF/BMP images and is detailed over on the forum (summary: I was using 32-bit integer accumulators and they were overflowing; switching to 64-bit accumulators fixed it). Any plugin that makes use of the built-in quantization code will also be fixed.

So I’ve decided to add some more value to this release in the way of performance optimizations. The first optimization affects an admittedly small population of users: those who have Intel Atom-based nettops. The Intel Atom D510 and 330 chips are dual-core CPUs with HyperThreading and so they show up in Task Manager as 4 CPUs. Normally Paint.NET always uses multisampling to render the canvas. However, if the system has less than 4 CPUs it will use nearest neighbor while doing a zoom in/out with the mouse wheel. Since the Atom reports 4 cores, it was not benefitting from this, but it is now noticably zippier.

The second optimization is for everyone. One thing I’ve been wanting to do for awhile is to move some of the rendering kernels into C/C++ land. The reason for this is that the Visual C++ compiler can do a lot better static optimization than either the .NET JITter or NGEN.

With just a few hours of work today, I’ve managed to make Gaussian Blur about 42% faster. I’ve also applied this trick to the Normal, Multiply, and Overlay blend modes and am getting 15-20% faster performance. The “code” is almost exactly the same except with “uint” swapped for “unsigned __int32”, some marshalling logic, P/Invoke glue, etc. The bang-to-buck ratio here is great.

And of course, your mileage may vary (YMMV). These benchmarks were done on a quad-core Intel Core i7 at 4GHz running 64-bit Windows 7. I also ran them on my dual-core Atom 330, and the improvement was 35% for Gaussian Blur, and 30+% for the blend modes.

With v3.5.5 I will probably limit these optimizations to a few select areas in order to “test the waters.” If stability is good, as determined by the stream of crash logs I get (or don’t!), then I’ll bravely expand to other areas. I expect to release v3.5.5 by the middle of April.

Oh, yeah. On the Paint.NET v4.0 front, the decision has been made: it will require Win7/Vista minimum. I’ve already got most of the interop layer for Direct2D, DirectWrite, and Windows Imaging Component (WIC) written. The first feature to use these was a replacement of “my” super sampling code for WIC’s “Fant” resampling. This means that the quality of Image->Resize when shrinking an image has been greatly improved. I also have a version of the Curves adjustment that uses Direct2D instead of GDI+ for rendering its UI (this was mostly “prove to myself it actually works” code).

Please do remember that Paint.NET v4.0 probably won’t be available until late 2011 – you have plenty of time to enjoy XP with Paint.NET v3.5.x in the meantime if that’s the way you roll (and it’s not like I can delete it off your box once 4.0 ships, nor would I if I could). As a pre-emptive snark, in true Raymond Chen style: this was a decision I made after much deliberation with both quantitative and qualitative data, and spamming my comment box won’t change my mind. Your voice has already been heard. Thanks in advance.

Intel’s Xeon X5680 gives you 24 threads, empties bank account

The guys over at 2CPU are quick on the draw with a review of the brand new, can’t-even-find-it-yet Intel Xeon X5680. It’s the bigger brother to the Intel Core i7-980X, itself a monstrous 3.33GHz, 6-core CPU. The Xeon has the extra pins and needles and validation to let you hook up 2 of them for a total of 12 cores. With HyperThreading that leaves you with 24 tiny little CPU graphs in Task Manager.

Do. Want.

Apparently AMD has some crazy chips coming out with 8- and 12-cores for 4-processor configurations, albeit at very low clock speeds. Still, 48 cores is within spitting distance of giving Windows 7 / 2008 R2 the fits. I have a nagging feeling that this level of performance will never make its way down to the $300 netbook/nettop level 🙂 As-is, a brand-new dual Xeon X5680 will set you back $1,600 USD per CPU, putting a whole system in the $5K+ USD range. Well, if you could find anyone who’s selling it anyway.

But the real question is, how fast does it run Paint.NET!? One of these would certainly cut my build times, now that Paint.NET is acquiring a large amount of C++/CLI in order to properly support Direct2D and DirectWrite. Using the /MP switch with the Visual C++ compiler results in all 8 threads of my Core i7-920 @ 4.0GHz being pegged at 100% for a significant amount of time.

Core i7-920 @ 4.0GHz, struggling to build the latest PaintDotNet.SystemLayer.Native DLL’s

February 2010 usage statistics

I was hoping to publish stats for January, but there was a problem with the web server logs not importing correctly for awhile. Everything’s cleared up though, so here we go!

Right now my primary interest is in planning for Paint.NET v4.0 with respect to determining system requirements. In other words, will it be possible to drop support for XP? The reason I’m trying to answer this is because I want to pervasively use Direct2D, DirectWrite, and DirectCompute while also not incurring an onerous development and testing burden. I want to render everything at high quality, and to use hardware acceleration where possible. These APIs are not available on XP. It appears to be feasible to write a Direct2D-to-GDI+ translation layer, but the other two APIs are not nearly so simple. I cannot justify dropping XP support if everyone’s still using it, or if there isn’t enough of a benefit. This decision must be guided by quantitative data, and not my desire to play with the latest and greatest along with fatigue from supporting ancient systems. One simple solution would be to just keep the last v3.x release available for download until XP support has dwindled far enough. Time will tell.

Anyway, hopes and dreams aside (please upgrade to Windows 7!), let’s see the stats!

The last few months have been huge for Paint.NET since the release of v3.5. The greatly improved performance and Aero UI theme have been very popular, and the “Install When I Exit” update mode has netted me more than a few e-mails full of thanks, praise, and smiley faces (glad you all like it!). I have not been working on new code or features, and instead have focused on relaxing and planning for v4.0. I plan to resume in earnest when Visual Studio 2010 is released; until then, I’m trying to finish Mass Effect 2 (renegade ftw) and BioShock 2. Anyone played Heavy Rain? Talk about mixed feelings; at least it didn’t suffer nearly the same fate as Indigo Prophecy with its awesome beginning that was quickly slaughtered by nonsensical, random plot twists and overly ridiculous quick time event sequences (they should have called it “Dance Dance Simon Revolution”). Oh, and I finally managed to get my Core i7 overclocked to 4.0 GHz by installing this beast.

Overall, usage of Paint.NET is up by a whopping 45%! The other two areas I’ve been hoping for big gains are in 64-bit and Windows 7, and boy are they on a roll! There are 212% more 64-bit users than last July, and Windows 7 is zipping up like a rocket and already claiming over 18% of the user base. Popularity with Russian users is way up, with most other languages staying about the same (technically English is down but this is probably just a result of the increase in the Russian stat).

Window Server 2003 continues to have a negligible number of users. I see no reason to discontinue support (e.g. hard block at install time), as it’s basically the same platform as Windows XP. I do not test with it though, so it’s a “best faith” effort. I don’t have separate stats for Windows 7 and Windows Server 2008 since they report the same version number (6.1.7600), and I don’t track the OS edition (workstation vs. server) with my update manifests.

Here are some ugly pie charts:

And lastly, here are the raw numbers. Please note that “hits” refers to update manifest text files, not web site traffic in a browser. They are the result of an installation of Paint.NET being active and checking to see what the latest version is. Paint.NET doesn’t check for updates unless it’s open (no TSR’s), and it checks every 5 days at most (longer if it hasn’t been opened in more than 5 days, of course).

July 2009 February 2010
Total hits 2,979,631 3,922,732
Hits per day 96,117 140,097
32-bit 94.45% 87.72%
64-bit 5.55% 12.28%
Windows XP 64.97% 56.43%
Windows 2003 0.32% 0.24%
Windows Vista / 2008 32.14% 25.02%
Windows 7 / 2008 R2 2.57% 18.31%
English 42.30% 38.86%
non-English 57.70% 61.14%
German 15.75% 15.34%
French 6.80% 7.76%
Portuguese 6.05% 4.85%
Spanish 6.01% 5.90%
Japanese 2.12% 2.24%
Italian 2.99% 3.56%
Polish 1.52% 1.54%
Netherlands (Dutch) 1.26% 1.37%
Russian 5.41% 9.48%
Chinese (Simplified) 0.83% 0.67%
Chinese (Traditional) 0.60% 0.46%
Turkish 4.32% 3.68%
Korean 0.46% 0.31%
All other languages 1.23% 0.93%
Have translations 83.31% 79.48%
Don’t have translations 16.69% 20.52%

Bold indicates that Paint.NET ships with the translation. Korean had a translation in v3.36, but not in v3.5+. For Russian, the reverse is true.