Tag Archives: software

The Benefits of Having Too Much Processing Power

Do an experiment: keep Task Manager or any other CPU activity monitoring program up on your screen for a few hour or days, glancing at it every so often. Do you see it EVER above zero (other than momentary spikes)?

Here’s mine, from a Google sidebar gadget:

mycputime

I’ve got a Dual Core and 2GB RAM. Currently I have open two copies of Visual Studio 2005, Word 2003, Outlook 2007, Paint.Net, RSS Bandit, Adobe Reader, IE, MSDN help, Windows Live Messenger, and Google Deskbar.

So that’s using just over 1 GB of RAM. And ZERO CPU. I’m watching this. The CPU meter goes up a little when I type, open a new program, compile my source code, etc., but most of the time it’s zero, even when I think I’m actually working.

I used to eschew running apps like Google Deskbar, wallpaper helpers like Display Fusion, or other system utilities that continually run. But I had a realization–it doesn’t matter! I could run many more utilities concurrently and still not come anywhere close to creating a slowdown on my computer.

Of course, I’m only talking about non-interfering/non-processor-intensive programs. This immediately excludes anti-virus programs, which interrupt every process to examine system behavior continually, or running video compression (duh) in the background.

But things like desktop searching, system monitoring (if it’s not too intrusive), utilities, and any other independent process–yeah, just throw them on. They won’t make a dent.

They key word in that last paragraph is independent. Independent means they don’t depend on or interfere with other processes.

Technorati Tags: ,,,,


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Problems with null character in WordPress feed?

In a recent post, I had this sequence of characters (which I’m expressing this way to avoid repeating the problem): <single-quote><backslash><numeral zero><single-quote>. That’s the NULL character, if you didn’t know.

It broke my feed. I’m not sure if it was IE or WordPress, but either way is bad so I replaced the offending sequence with a comment the feed was fixed.

Technorati Tags: , ,


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Software Spoilage

Jeff Atwood had an interesting post about software spoilage, in which he quotes PC World’s list of no-longer-good-too-bloated applications which includes Windows Media Player 11.

Are they kidding? WMP11 is a LOT better than WMP 9 and 10. It has better organization, and the fact that I can do instant filtering on albums, genres, artists, songs, and anything else is a killer feature. I’ve got about 16,000 tracks, mostly classical and soundtrack. I couldn’t live without WMP11’s organizational and filtering capabilities. Sure, it’s big, but I don’t notice a slowdown.

I do agree about other things in the list. Paint Shop Pro has definitely become much too big. What was attractive about it was its small size and lack of features, which made it approachable. Nowadays, I use Paint.Net. Simple, open-source, easy to use.

Technorati Tags: , ,


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

The users are in control

I really enjoyed and appreciated this essay from Raganwald about the user experience at work versus that of their home PC environments (among other topics).

I particularly liked the point:

And meanwhile, the very same users could walk across the street and buy themselves a much better PC for less money than we pay and take it home the same day.

Ain’t that the truth. I put together my Core 2 Duo system for the same price as my crappy Pentium 4 hyperthreaded number at work. The time frames were not that far apart. The Core 2 runs circles around this sick puppy.

A company’s philosophy should be to get users (especially developers like me!) whatever hardware/software they need immediately. Within minutes or hours, not days or weeks. Of course, then you have to trust your employees to make good requests. But if you don’t trust them to know what they need, why trust them to do their job at all?

The essay goes on to talk about writing applications that take advantage of modern PC horsepower. I think I’m doing an ok job of this at work now. For example, we have a database of assets that is continually growing. It used to be we could view all of the assets on a single page that took about 30 seconds to load off-site.

Now that list will take several minutes to bring up. Yeah, we’re growing. So we need tools to help manage all of that information. One thing I’m building right now (as soon as I’m done writing this, as a matter of fact) is a quick filtering functionality on a desktop app that talks to the database. The list of assets is filtered as you type, taking advantage of the fast PCs we have these days.

That’s just one example. I can think of others that are immediately useful in business apps:

  • better visualization – it takes time and thought to develop good data visualization, but the results are usually worth it
  • drag & drop support – make sense to drag assets from a customer to another? I don’t know, maybe.
  • dynamic views – use all that processing power to show something more interesting than fields on a scrolling form. Graphics views that change in response to context
  • track history, undo/redo – might make sense in some contexts
  • attach more meaningful information – pictures, videos, documents, whatever. – with stuff like WPF, it’s easier than ever to display varied content

Technorati Tags: , , ,


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Don’t ignore naive or "stupid" algorithms — hardware is cheap and fast

I just had a nice reality check. Sort of pleasant in that I realized I could save a LOT of memory usage (like from 35MB down to 9 MB), but also aggravating because I have spent probably 10-20 hours developing a clever algorithm designed for speed.

Lesson learned. I should have built the naive version first. Instead, I wrote up two successively more “brilliant” versions that went through all sorts of hoops to get the most speed out of it. Of course, to do this, they took up all sorts of memory with indexes, and the index creation was starting to take about 10 seconds or longer. I should have just built the naive version.

I just wrote the naive version and realized I could have done that in about 5 minutes and saved many hours of tweaking. The component is a type of indexing component, so there were three metrics: index creation time, lookup time, index size. Here’s a rough comparison just to give an idea:

  Clever Algorithm Naive Algorithm
Index Creation Time 10s 0.3s
Lookup Time 0.0001s 0.005s
Index Size 35MB 9 MB
# items

~27,000

Pretty impressive speed numbers aren’t they! That clever algorithm really rocks. And it would be awesome to use if I was doing a lot of searching consecutively, but the searching in my app is tied to the UI, thus to the user, so in reality 0.005 seconds is not that much different than 0.0001 seconds. <sigh>

The numbers above are from my main machine, which is a Core 2 Duo. Just to be safe I tested the naive algorithm on my 4-year-old Pentium 4 laptop to validate that it still has acceptable performance on an older machine. The creation takes 0.05 seconds, but lookup time isn’t much slower, if at all.

And 9MB index is MUCH better than a 35MB index.

In summary, lessons learned:

  1. Hardware is cheap and fast. Don’t waste time optimizing for speed if you don’t have to. While there are signs the raw speed of a processor is plateauing as multiple cores become more important, in general, speed is always increasing.
  2. If you’re running something when a user inputs something, speed isn’t critical (as long as you have it faster than human response time)
  3. Every application is different, so measure and think critically. If my app needed to run the search 100 times per second, the clever algorithm would definitely be better.
  4. There is almost always a tradeoff between speed and size. Which is more important depends on the app.
  5. Write the dumb algorithm first. It might be good enough and you’ll save yourself hours of development and debugging time.

Technorati Tags: , , , , ,


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

DiskSlicer 1.0 Released!

[Note: edited to reflect updated name]
A little pet project of mine, DiskSlicer, has finally reached the 1.0 stage. It does one thing, but does it well: shows you your disk space is allocated among all the folders and files on your drives. It can be an invaluable tool for figuring out where all your space is going. Free for personal use!

Find out more.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Code formatter for Windows Live Writer

I stumbled across a great code formatter for Windows Live Writer today. Here’s an example, using a C# function that converts a number into a formatted file size:

       public static string SizeToString(long size) 
        { 
            const long kilobyte = 1L << 10; 
            const long megabyte = 1L << 20; 
            const long gigabyte = 1L << 30; 
            const long terabyte = 1L << 40; 
            string kbSuffix = "KB"; 
            string mbSuffix = "MB"; 
            string gbSuffix = "GB"; 
            string tbSuffix = "TB"; 
            string suffix = kbSuffix; 

            double divisor = kilobyte;//KB 
            if (size > 0.9 * terabyte) 
            { 
                divisor = terabyte; 
                suffix = tbSuffix; 
            } 
            else if (size > 0.9 * gigabyte) 
            { 
                divisor = gigabyte; 
                suffix = gbSuffix; 
            } 
            else if (size > 0.9 * megabyte) 
            { 
                divisor = megabyte; 
                suffix = mbSuffix; 
            } 

            double newSize = size / divisor; 
            return string.Format("{0:F2}{1}", newSize,suffix); 
        }

Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Code Formatter Plugin for Windows Live Writer

I stumbled across a great code formatter for Windows Live Writer today. Here’s an example, using a C# function that converts a number into a formatted file size:

       public static string SizeToString(long size) 
        { 
            const long kilobyte = 1L << 10; 
            const long megabyte = 1L << 20; 
            const long gigabyte = 1L << 30; 
            const long terabyte = 1L << 40; 
            string kbSuffix = "KB"; 
            string mbSuffix = "MB"; 
            string gbSuffix = "GB"; 
            string tbSuffix = "TB"; 
            string suffix = kbSuffix; 

            double divisor = kilobyte;//KB 
            if (size > 0.9 * terabyte) 
            { 
                divisor = terabyte; 
                suffix = tbSuffix; 
            } 
            else if (size > 0.9 * gigabyte) 
            { 
                divisor = gigabyte; 
                suffix = gbSuffix; 
            } 
            else if (size > 0.9 * megabyte) 
            { 
                divisor = megabyte; 
                suffix = mbSuffix; 
            } 

            double newSize = size / divisor; 
            return string.Format("{0:F2}{1}", newSize,suffix); 
        }

Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Linux Reality Check

Over at Slashdot, Fedora Project Leader Max Spevack responds to some frank question about the Fedora project.

He talks about a number of topics:

  1. Unified package managers across distros
  2. Propritetary drivers
  3. Differences in Linux over time
  4. Fedora’s biggest weakness
  5. Threat of Vista
  6. inclusion of NTFS driver in kernel
  7. Wacky package dependencies
  8. a few others…

What his article demontrates to me is that Linux is going through some growing pains and that the community is realizing the difficulties that Apple and Microsoft have already dealt with in their own ways.

For example,

I guess the “problem” with package managers is that they are so integral to the rest of a distro that it’s a major endeavor to switch them. One reason is that a switch of that kind would break the upgrade chain.

Welcome to the real world of computing. Upgrading, advancing, improving are all important issues for real users using their computers. The only reason we still use the x86 architecture is backward compatibility. The only reason Windows has universal marketshare is that it works with basically everything ever written.

Another fundamental issue:

In terms of getting people to use Linux instead of proprietary operating systems — I think that battle is best fought in the world of people who are new to computers. People will tend to be loyal to the first thing that *just works* and doesn’t cause them pain. Making that first experience for people a Linux one as opposed to a proprietary one — that’s the challenge.

How true. It’s been a while since I’ve installed Linux, but my memories of it were not all that pleasant. It worked well enough, I suppose, but it certainly isn’t as polished or streamlined as it should be. MS and Apple are still years ahead of Linux in this regard.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order:

Microsoft Sandcastle Released

Now that NDoc is officially dead, and without support for .Net 2.0, it is a relief to many that Microsoft has released Sandcastle, the tool that they use to build MSDN documentation.

Update: A FAQ/blog is available. I couldn’t subscribe to the feeds in RSS Bandit, however. It may be a temporary problem.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order: