It feels like it’s been a while since I did much of that, though: I used the Async CTP sporadically with Visual Studio 2010 – and then used async/await much more extensively when writing apps for Windows 8 – but the fact it’s not been native to the version of the .NET framework used inside AutoCAD has meant I’ve not been using it heavily.

This is an interesting – although quite in-depth – session on async/await. If you’re relatively new to the concepts behind this mechanism, I do suggest looking at some more introductory sessions, first, but this one is definitely worth a watch for anyone who has wondered about the additional work the compiler does when you make use of async/await. And what you can do to improve performance when you need to.

Stephen classes himself a library writer, which means he really cares about low-level system performance. But Stephen’s also pragmatic about how much optimisation needs to be applied to a system – here’s a comment he made a little after the 12-minute mark in this session:

“I always recommend: write your code the way you want to write it. Run your performance tests (everyone should have performance tests). If your performance tests meet your needs/goals, great, you’re done. But if they don’t meet your goals then you need to start thinking through some of these best practices.”

This makes a lot of sense to me. I typically code at the application (rather than library) level and – given the relatively finite amount of time I can allocate to writing blog posts – I tend not to have the chance to focus much on low-level optimisation. It happens from time to time, but not systematically.

This is an important point for readers to note, especially if you want to build code posted here into your own libraries: you really need to make sure it meets the performance requirements for that library – and for your broader application – otherwise you’ll need to optimise it (the chances are it hasn’t been). At some point it might be worth covering some optimisation “best practices” that relate to AutoCAD on this blog… my colleague Albert Szilvasy will be presenting on this at AU2013, so I may well get something from him to share, at some point.