Monthly Archive for May, 2008

.NET Console.Writeline Performance Issues

We ran into an interesting problem recently that I have not been able to find documented anywhere.

We’re doing real-time USB data acquisition with .NET 2.0. The data bandwidth and processing isn’t overwhelming. Specifically, we expect data packets at 50 Hz — every 20 ms. Yet we were having horrible delay problems. In the end we found that Console.Writeline was the culprit!

To verify this a test program was written to measure the throughput of the following loop:

The length of mstr is varied and this loop is run for about 30 seconds. The results show the ms per message for increasing message lengths:

Console.Writeline Performance

Console.Writeline is surprisingly slow!

We use log4net for our logging. With the timestamp and class information, a log message is typically greater than 100 characters. A single log message introduces at least a 20 ms delay in that case, with additional messages adding that much more. Even though debug logging would not be included in the released version, these significant delays make development difficult.

Not only do you need to make sure that there are no Console.Writeline's in your real-time threads you also need to remove the console appender (<appender-ref ref="ConsoleAppender"/>) from the log4net configuration. The log4net file appenders do not cause noticeable delays.

Selecting Books About Programming

This is tough to do. There are tons of technical books out there. Also, now that the Internet can instantly answer just about any question, the path of least resistance leads to arguments like this: Why I don’t read books.

There is no right or wrong when in comes to learning methods. It’s a personal preference. I’m a book reader, but I can understand how Internet content (blogs, articles, etc.) has made it easy for people that don’t like books (for whatever reason) to acquire relevant knowledge.

The availability of “Best” lists are abundant. For example:

OK, so once you get past the classics (Code Complete 2, The Pragmatic Programmer, Design Patterns, etc.) where do you go from there?

I will typically invest in books on emerging technologies that I want to fully understand (a recent one was Windows Presentation Foundation Unleashed — highly recommended). The real challenge is finding a book that doesn’t suck. Reviews and recommendations by other readers, like from the sites above, are the best resources.

My other vetting technique is standing (and reading) for long periods of time in the nerd-book section of a bookstore. There’s no substitute for browsing the pages of a real book. The one that’s still in your hand when your SO drags you towards the exit is probably the best one to buy.

Drop, Spike… Huh?

I guess I didn’t get the memo.

Here’s the first couple of sentences from this post:

Several drops ago we introduced a ViewModel composition spike. The purpose of this spike was to introduce…

I don’t know why, but this terminology caught me by surprise. My interpretations are:

  • Drop: a software release.
  • Spike: a quickly written new or enhanced feature used as a proof of concept (e.g. see here)

Drops are sometimes used in CodePlex-P&P projects and spikes are often referenced in the ALT.NET discussion group (searched for here).

Anyway, I like the sound of these. They’re succinct and to the point. I foresee them becoming a common part of the developer’s lexicon.

UPDATE: OK, so I’m not an Agile developer. In particular, I have not experience with XP (Extreme Programming), which defines a ‘Spike’: Create a Spike Solution

Google Health Launches: More PHR for the masses.

It’s finally here: Drumroll, Please: Google Health Launches!

If you use any of the Google applications (like Gmail), it’s just as easy as all the others:

Google Health

It will be interesting to see if this and HealthVault have an impact on how patients interact with their medical service providers. The privacy and security issues are certain to remain a significant barrier to adoption. Only time will tell.

UPDATE (5/23/08): See Delving Into Google Health’s Privacy Concerns

UPDATE (5/24/08): Apparently this Slashdot reference is “uninformed”: Why Google Health and HealthVault are not covered by HIPAA.

UPDATE (7/6/08): I ran across this post that talks about Microsoft HealthVault security: You Will Never Get It Microsoft. Here’s a quote from it:

Microsoft obviously think that I don’t know how HealthVault works. I don’t have to know how it works, I only know that it will and can be abused one day.

Are you asleep at the wheel?

I guess I’m a sucker for EEG related technology (see all my HCI posts). So when I run across an article like A baseball cap that reads your mind I can’t help but comment on it.

A baseball cap that reads your mind

Unlike other “mind reading” systems that make unrealistic claims, I can see this research and wireless technology leading to something quite useful. The ability to discern closed eyes and drowsiness by the presence of alpha waves (8-12 Hz) in human EEG is well known.

Developing an affordable product that provides a timely audible alert to a driver that’s about to fall asleep could have a huge impact. From (beware, this is a PowerPoint presentation) Fatigue and Automobile Accident Risk:

The US Department of Transportation estimates that 100,000 accidents reported are due to drowsiness and/or fatigue. These crashes result in 1550 deaths annually (4% of traffic fatalities) and $12.5 billion in monetary losses.

Even the annoyance of false alerts would be worth the lives saved. And of course it’s convenient that a lot of truck drivers already wear baseball caps.

Microsoft Health Common User Interface (CUI) v1.3

Last year I looked at the MSCUI. Along with the v1.3 release is a glimpse into the future. The user experience is greatly enhanced with the use of Silverlight 2.0. Check out the Patient Journey Demonstrator (you’ll need to install Silverlight first):

Patient Chart

Bill Crounse has a good overview and links here.

The UI busy and complex, but there seems to be an intuitive consistency to the madness. Besides the slick look, one of the great things about Silverlight (and WPF) are the transition animations that makes using the controls a feel-good experience.

Most of the Silverlight/WPF demos I’ve seen are photo/video mashup types of applications. The MSCUI clinical workflow and patient record demos give you a much better appreciation for how this UI technology can be put to effective use.

I still think the MSCUI Design Guidance documents are the key to success. Everybody goes gaga over the cool graphics and animations, but these requirements need to drive the use of the technology.

UPDATE (9/11/08): MSCUI R1.5 is now live.

ALT.NET for the Rest of Us

If you follow Microsoft comings and goings, one of the more interesting developments (at least to me) over the last 8 months has been the formation of a community that calls themselves ALT.NET.

As explained in What is ALT .NET?, the term was coined by David Laribee last year and describes a group of

like-minded individuals within the larger world of the Microsoft® .NET Framework who felt a growing frustration that Microsoft tooling, guidance, and .NET culture at large did not reflect or support an important set of core values.

The name is misleading because even though most members are from the .NET community, the group’s purpose is to promote a set of core values that are platform/language independent. To summarize from Jeremy’s article:

  1. Keeping an eye out for a better way.
  2. Adopt the best of any community.
  3. Not content with the status quo — experimenting with techniques.
  4. It’s the principles and knowledge that really matter.

The members of the ALT.NET group are distinguished technologist and many are productive bloggers, e.g. and Ayende@Rahien. Also, the discussion group altdotnet is very active (over 6200 posts since the beginning of the year) and lively. There are also periodic group meetings (see the ALT.NET site for links) that use Open Space Technology (OST) to organize conference agendas. Check out the interesting videos (by David Laribee) from the recent conference in Seattle.

So why are ALT.NETters not like the rest of us? We’re experienced developers that use modern tools and techniques, but we:

  • Have never used enterprise-class frameworks and tools (e.g. Biztalk, P&P Application Blocks, ESB, TFS, etc.).
  • Have never worked with a “Software Architect”. We have always had to design and develop our own systems.
  • Have experimented with Agile development methodologies but have never been part of a “real” Agile team.
  • Think Pair programming is an April Fool’s joke.
  • As with Agile, we know about all the different “driven” software development approaches, but have never had the opportunity to fully embrace any of them.
  • Have heard about Boo, Spec#, and F#, but have never used them.

This list could go on and on. Many have never used an ORM or the MVC design pattern either. The point isn’t what we know versus what they know. I’ve talked about Stereotyping Programmers before and how it’s just plain bad. I think the ALT.NET community has made a conscious effort to improve their inclusiveness.

The ALT.NET group is certainly on the cutting edge of useful and innovative software technologies and techniques. We may not understand everything they’re talking about, but the conversation is well worth listening to. Someday you may be faced with a challenge that will need just the type of solutions they’ve been discussing.



Twitter Updates