Category Archives: microsoft

Announcing Microsoft.IO.RecycableMemoryStream

It is with great pleasure that I announce the latest open source release from Microsoft. This time it’s coming from Bing.

Before explaining what it is and how it works, I have to mention that nearly all of the work for actually getting this setup on GitHub and preparing it for public release was done by by Chip Locke [Twitter | Blog], one of our superstars.

What It Is

Microsoft.IO.RecyclableMemoryStream is a MemoryStream replacement that offers superior behavior for performance-critical systems. In particular it is optimized to do the following:

  • Eliminate Large Object Heap allocations by using pooled buffers
  • Incur far fewer gen 2 GCs, and spend far less time paused due to GC
  • Avoid memory leaks by having a bounded pool size
  • Avoid memory fragmentation
  • Provide excellent debuggability
  • Provide metrics for performance tracking

In my book Writing High-Performance .NET Code, I had this anecdote:

In one application that suffered from too many LOH allocations, we discovered that if we pooled a single type of object, we could eliminate 99% of all problems with the LOH. This was MemoryStream, which we used for serialization and transmitting bits over the network. The actual implementation is more complex than just keeping a queue of MemoryStream objects because of the need to avoid fragmentation, but conceptually, that is exactly what it is. Every time a MemoryStream object was disposed, it was put back in the pool for reuse.

-Writing High-Performance .NET Code, p. 65

The exact code that I’m talking about is what is being released.

How It Works

Here are some more details about the features:

  • A drop-in replacement for System.IO.MemoryStream. It has exactly the same semantics, as close as possible.
  • Rather than pooling the streams themselves, the underlying buffers are pooled. This allows you to use the simple Dispose pattern to release the buffers back to the pool, as well as detect invalid usage patterns (such as reusing a stream after it’s been disposed).
  • Completely thread-safe. That is, the MemoryManager is thread safe. Streams themselves are inherently NOT thread safe.
  • Each stream can be tagged with an identifying string that is used in logging. This can help you find bugs and memory leaks in your code relating to incorrect pool use.
  • Debug features like recording the call stack of the stream allocation to track down pool leaks
  • Maximum free pool size to handle spikes in usage without using too much memory.
  • Flexible and adjustable limits to the pooling algorithm.
  • Metrics tracking and events so that you can see the impact on the system.
  • Multiple internal pools: a default “small” buffer (default of 128 KB) and additional, “large” pools (default: in 1 MB chunks). The pools look kind of like this:

RecylableMemoryStream

In normal operation, only the small pool is used. The stream abstracts away the use of multiple buffers for you. This makes the memory use extremely efficient (much better than MemoryStream’s default doubling of capacity).

The large pool is only used when you need a contiguous byte[] buffer, via a call to GetBuffer or (let’s hope not) ToArray. When this happens, the buffers belonging to the small pool are released and replaced with a single buffer at least as large as what was requested. The size of the objects in the large pool are completely configurable, but if a buffer greater than the maximum size is requested then one will be created (it just won’t be pooled upon Dispose).

Examples

You can jump right in with no fuss by just doing a simple replacement of MemoryStream with something like this:

var sourceBuffer = new byte[]{0,1,2,3,4,5,6,7}; 
var manager = new RecyclableMemoryStreamManager(); 
using (var stream = manager.GetStream()) 
{ 
    stream.Write(sourceBuffer, 0, sourceBuffer.Length); 
}

Note that RecyclableMemoryStreamManager should be declared once and it will live for the entire process–this is the pool. It is perfectly fine to use multiple pools if you desire.

To facilitate easier debugging, you can optionally provide a string tag, which serves as a human-readable identifier for the stream. In practice, I’ve usually used something like “ClassName.MethodName” for this, but it can be whatever you want. Each stream also has a GUID to provide absolute identity if needed, but the tag is usually sufficient.

using (var stream = manager.GetStream("Program.Main"))
{
    stream.Write(sourceBuffer, 0, sourceBuffer.Length);
}

You can also provide an existing buffer. It’s important to note that this buffer will be copied into the pooled buffer:

var stream = manager.GetStream("Program.Main", sourceBuffer, 
                                    0, sourceBuffer.Length);

You can also change the parameters of the pool itself:

int blockSize = 1024;
int largeBufferMultiple = 1024 * 1024;
int maxBufferSize = 16 * largeBufferMultiple;

var manager = new RecyclableMemoryStreamManager(blockSize, 
                                                largeBufferMultiple, 
                                                maxBufferSize);

manager.GenerateCallStacks = true;
manager.AggressiveBufferReturn = true;
manager.MaximumFreeLargePoolBytes = maxBufferSize * 4;
manager.MaximumFreeSmallPoolBytes = 100 * blockSize;

Is this library for everybody? No, definitely not. This library was designed with some specific performance characteristics in mind. Most applications probably don’t need those. However, if they do, then this library can absolutely help reduce the impact of GC on your software.

Let us know what you think! If you find bugs or want to improve it in some way, then dive right into the code on GitHub.

Links


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

Book Review: High-Performance Windows Store Apps

I recently read Brian Rasmussen’s book High-Performance Windows Store Apps, and I think it’s an excellent companion to my own Writing High-Performance .NET Code.

It’s a good companion because while my book is all about the nitty-gritty details of .NET and how they effect performance, I don’t go too much into things at the UI layer. My perspective is much more systems and servers based, while Brian is coming at this from a UI/XAML focus. Brian covers a bunch of topics in a very good way.

The title specifically mentions “Windows Store” apps, but the principles and techniques described in here apply to any desktop/UI application, not just the types you see typically on tablets or phones. It’s worthwhile even if you develop just desktop apps.

Particular things I liked:

  • Chapter 3 – Designing for Performance – It presents a number of interesting performance scenarios, many of which aren’t obvious if you’re new to the new world of multi-device, cloud-connected apps we’re in. The discussion on resource management and prioritization was good too.
  • Chapter 4 – Instrumentation – A very good walkthrough of Event Tracing for Windows, which is what every developer needs to know these days, for tracking app events for performance, debugging, or just plain logging. Lots of good stuff here, and critical for all performance analyses these days.
  • Chapter 5 – Performance testing – Lots of good stuff in here I didn’t know about, particularly around building an automated performance testing environment for UI apps. Automation is critical, and this gives some good examples to get you on your way.

The book used the Windows Performance Recorder for most of its examples. It’s an excellent tutorial on how to make this tool useful to you, without getting bogged down into the complexities.

Overall, highly recommended. There are not very many guides on how to do performance engineering for XAML apps, and Brian writes a great one.

You can follow Brian on Twitter @kodehoved. Check out High-Performance Windows Store Apps at Amazon.


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

50 Reasons You Should Be Using Bing

I frequently get asked by family, friends, and acquaintances why they should use Bing over our competitors. This post is a comprehensive answer to that question, as much as it can be.

Note that I’m hardly an unbiased observer. I work for Bing, but I work deep in the layers that do the bulk of query serving, not on user-facing features. If you want a technical peek at the kind of work I typically do, you can read my book about Writing High-Performance .NET Code.

This post isn’t about that. It’s about all of the things I love about Bing. I haven’t been asked to write this. I’m doing it completely on my own, without the knowledge of people whose job it typically is to write about this kind of stuff. But I don’t see many blogs talking about these things consistently, or organizing them into a coherent list. My hope is that this will be that list, updated over time.

So standard disclaimer applies: This blog post is my opinion and may not represent those of my employer.

Second disclaimer: I will not claim that all of the things I list are unique to Bing. Some are, some aren’t, but taken together, they add up to an impressive whole, that I believe is better overall.

Third disclaimer: new features come online all the time, and sometimes features disappear. Tweaks are always being made. Some of the described features may work differently in your market, or may change in the future.

To try these examples out for yourself, you can click on most of the images below to take you to the actual results page on Bing.com.

On to the list:

1. Search Engine Result Quality

Bing’s results are every bit as relevant as Google’s and often more so. While relevance is a science that does have objective measures, I do not know of any publically available reports that compare Bing and Google with any degree of scientific precision. However, reputable sources such as SearchEngineLand have weighed in and found Bing superior in many areas.

Not too surprisingly, there was not a massive disparity in the results of my little test. In fact, Bing came out on top. Some queries performed very differently than others, for example, Bing was able to tell that my query for “Attorney Tom Brady”, was looking for an attorney and not the pictures of the hunky Patriots quarterback served up by Google.

Bing also did well with date nuances, unlike Google…

For the layperson, the relevance of a search engine is often personal and subjective. I enthusiastically recommend the BingItOn challenge that allows you to perform brand-blind search comparisons.

image

Bing certainly did not start out on an equal footing. Even when I started working at Bing over 6 years ago (before it was Bing), I would sometimes have to jump to Google to find something a little less obvious. The only reason I visit Google now is to verify the appearance of my blog and websites in their index.

2. The Home Page Photo

This was the killer feature that “launched” Bing in the minds of many people. Not just any photo, but exceptional works of art from Getty, 500px, and more. (At one time, photo submissions were accepted from Bing employees. I should see if that’s still possible…)

image

These photos showcase the beauty of our world and culture. Localized versions of Bing.com often have different photos on the same day, giving a meaningful interaction to users all over the world.

You can also view pictures from previous days.

3. Dive Into the Photo to Explore the World

In the bottom-right of the photo, there is an Info button that will take you to a search result page with more information about the subject of the photo.

image

In addition, as you move the mouse over the image, four different “hotspots,” marked with semi-transparent squares are highlighted. Clicking on them takes you to search results pages with more information about related topics, such as the location, similar topics, and more.

image

4. Use the Photo as your Windows Desktop Wallpaper

image

Click on the Download button in the lower-right corner to download the image to your computer for use as your wallpaper. A light Bing watermark will be embedded.

5. See Every Amazing Photo from the last 5 Years

Just visit the Bing Homepage Gallery and view every photo in one list, or filter them to try to find your favorites.

image

6. Bing Desktop Brings it all to your Windows Desktop

Bing Desktop takes that gorgeous photo and automatically applies it as your Windows Desktop wallpaper image each day. From the floating toolbar or the task bar, it provides instant access to searching Bing or your entire computer, including inside documents. Bing Desktop also shows you feeds of news, photos, videos, weather, and your Facebook news feed. All of this is configurable. You could use it just to change the wallpaper if you like.

image

7. More Attractive Results Page

Beauty is in the eye of the beholder, but I don’t know if anyone can look at Google’s search results page and claim they’re attractive, especially when laid next to Bing’s. It’s true for nearly all results, but especially true for product searches, technical queries, and many other structured-data type results.

Here is one for a camera. Bing breaks out a bunch of information and review sources on the right, which is already a great head start, but even in the normal web results in the main part of the page, Bing has an edge. The titles, links, and subheadings with ratings all look better.

image

image

Try it out on a bunch of different types of queries. Bing just looks better, in addition to giving great results.

8. Freedom to Innovate

Bing tries a lot of experiments, throws a lot of new features out there to see what works and what doesn’t. We have that freedom to try all sorts of new things that more established players may not enjoy. Bing can change its look and functionality drastically over time to attract new types of users. You will see a lot of new things on Bing if you start paying attention. As a challenger, we are less beholden to advertisers then other search engines.

9. News Carousel

Along the home page photo is a carousel of topics, including top news (customizable to topics you are interested in), weather, trending searches, and more. This list is related to your Cortana entries as well (more on Cortana later).

image

You can collapse this bar in two stages. The first click will remove pictures and reduce the number of headlines.

image

A second click will remove all traces of it, other than the button bringing it back.

image

10. Image Search

Bing’s image search functionality is unparalleled. It presents related searches as well as a ton of filtering mechanisms in an attractive, compact grid that maximizes the screen real estate so you can find what you need faster. Bing also removes duplicates from this list so it doesn’t end up being just a long selection of the exact same image.

image

The filtering mechanism even includes niceties like license type:

image

If you’re searching for people, then you can filter by pose as well.

image

Clicking on an image brings up a pop-up with the larger version of the image. This screen allows you to view the image directly, visit the page it came from, find similar images, Pin it to Pinterest, among other things. Along the bottom is a carousel of the original image search results.

image

11. Video Search

Like image search, video search is far better than the competition. Holding the mouse over a thumbnail results in a playing preview with sound.

image

Clicking on a video brings up a larger preview version with a similar layout as the image search.

Like images, the list of videos also has duplicates removed. While YouTube may command the lion’s share of video these days, Bing will show videos from all over the web.

12. It Does Math For You

Yeah, it will do 4+4 for you, and then bring up an interactive calculator:

image

Big. Deal.

However, it can do advanced math too! It can also solve quadratics and other equations:

image

Handles imaginary numbers to boot. Ok, that’s pretty cool. Does the competition do this? No.

13. Unit Conversion

Yes, it will convert all sorts of lengths, areas, volumes, temperatures, and more, even ridiculous ones:

image

14. Currency Conversion

When I look at my book royalties in Amazon, it displays them in the native currency rather than what I actually care about: good ol’ USD. Bing to the constant rescue:

image

More natural phrasing also works, such as “100 euros in dollars”

15. Finds the Cheapest Flights For You

Searching for: “seattle to los angeles flights” yields this little widget:

image

Update your details and click Find flights and you get:

image

16. Get At-a-Glance University Information

The most useful information about universities is displayed for you right on the results page, including the mailing address, national ranking, enrollment, acceptance rates, tuition, and more, with links to more information.

image

17. Find Online Courses

This is one of the coolest features. Notice the online courses list in the previous image? Those are free, online courses offered by the school. Clicking on them takes you directly the course page where you can sign up.

18. Great Personality and Celebrity Results

You can get a great summary and portal to more information for many, many people. It’s not just limited to the usual actors and recording artists. Atheletes, authors, and more are included too, such as one of my favorite authors, the late, great Robert Jordan (AKA James Oliver Rigney, Jr.):

image

For singers, you can sample some of their tracks right from Bing:

image

Clicking on a song does another search in Bing which gives more information about the song itself, including lyrics, and links to retailers to purchase the song.

19. Song and Lyric Information

Searching for a song title will give you a sidebar similar to that for artists:

image

Searching for lyrics specifically will show those as well:

image

20. Great for Finding “Normals” Too

I don’t have the most popular name (at least in the U.S. – I suspect it’s more common in the U.K.), but if I do a search for it, I get this:

image

That’s…not me.

But if I qualify my name with my job, “Ben Watson Microsoft Bing”, then I get something about me, admittedly not much (hey, I’m not that famous!):

image

Clicking on my name brings up results including this blog and LinkedIn profile.

21. Find Product Buying Guides

This is probably one of the most popular types of searches. I research things both small and large and while there isn’t always a card for each item, often there is.

Try the search “vacuum cleaner recommendations”:

image

Or better, try “Windows Phone reviews” and you get a similar sidebar:

image

If you click on a manufacturer, it brings up a carousel for phones of that brand:

image

Click on those in turn bring up web search results for each one.

22. The Best Search Engine for Programmers

I have so far abstained from showing many Bing vs. Google head-to-head, but I just have to for this. The query is “GC.WaitForPendingFinalizers”, a .NET Framework method.

Here are the first two results of Bing on the left, compared to Google on the right:

image

Bing has a much more attractive and useful layout, links to various .NET versions, and a code sample! For the StackOverflow result, it shows related questions grouped under the most relevant question it found.

23. Time Around the World

My family is spread out throughout the world, from all over the US to Europe. I can generally figure out what time it is on the East coast, but what my family in Arizona, where they don’t have Daily Savings Time—are they in the same time zone as me right now or not? What time is it in Sweden?

image

24. Package Tracking

Just copy & paste the tracking number from your product order into Bing, and you’ve got a link directly to the carrier’s tracking page:

image_thumb39

(The tracking number in that screen shot has been censored by me, and there is no link to a live results page.)

25. Search Within the Site, from Bing

Many web sites have search functions built-in to them. You can take advantage of these directly from Bing. For example, search for the popular book social media site Goodreads.com:

image90

If you then type something into that search back and click “Search” you will be taken to a results page on that web-site directly. Not a huge feature, but it saves you a few clicks.

26. Recipes

You can get top-rated recipes directly in Bing, with enough of a preview to know if you want to read more details.

Here’s a search for “chicken parmesan”:

image96

27. Nutritional Information

Highlighted recipes will have nutrition information, but so will plain foods, such as “pork tenderloin”:

image1011

28. Local Searches

The go-to query for this is “pizza”, but around here pho is nearly as important (to me, anyway). If you search for “pho Redmond” you get a carousel showing the top restaurants. This carousel interacts with the map of the local area:

image112

There is an alternate format that shows up for things without pictures, such as piano stores:

image113

But some topics just have so much about them. Revisiting “pizza”, these results will include the restaurant carousel, nutrition facts, a map, images, and more.

29. City Information

If you do a search for a city, you will get images, some top links for tourist information, and a sidebar containing a map, facts, the current weather, points of interest, and even live webcams!

I lived in Rome for a year, and loved it. There is enough there to fill a month of sight-seeing and still not cover nearly everything. Bing conveys a bit of that:

image118

30. Advanced Search Keywords

Sure, Bing tries to guess what you mean just from the words and phrases you type, but there are ambiguous scenarios that require some more finesse. The ones I use more often are “” (quotes), + (must have), and – (must not have). For example:

“Ben Watson” +Bing –football

Indicates that the phrases “Ben Watson” should be included, Bing must be included, and football must NOT be present.

Start with these advanced search options, and then move on to some more advanced keywords that give you even more power, like:

.NET ext:docx

Will find documents ending with the docx extension containing the word .NET.

or site: which restricts results to pages from a specific site, or language: to specify a particular language.

31. Bing Maps and Bird’s Eye View

Bing Maps by itself is great. It provides all the standard features you expect: directions, live traffic, accident notification, satellite imagery, and more.

But the really cool thing is Bird’s Eye View, which offers an up-close, detailed, isomorphic view of an area. Check out this shot:

image5[1]

You’ll get that view automatically if you keep zooming in, but you can switch to a standard aerial view as well.

32. Mall Maps

Search for a mall near you and see if it has this information. Here’s one from Tysons Corner Center in Virginia:

image15

Now click on Mall Map, which will take you to Bing Maps, but show you a map of the inside of the mall!

image201

You can even switch levels:

image_thumb12

33. Airport Maps

The same inside map feature exists for airports too. Here’s a detail of SeaTac:

image5

You can see individual carrier counters, escalators, kiosks, stores, and more.

34. Venue Maps

I think you get the idea…

image10

35. Answers Demographic Questions

image52

 

36. Awesome Special Pages

Did you see the Halloween Bing page from 2013? No? I could not find a way to access it now, but someone did put a video of it up:

Bing’s 2013 Halloween home page was interactive

37. Predictions

Bing analyzes historical trends, expert analysis, and popular opinion to predict the outcomes of all sorts of events, including a near-perfect record for the World Cup. Bing can also predict the outcomes of NFL games, Dancing with the Stars, and more.

image17[2]

image22[2]

To see all of the topics Bing can predict (with more coming soon), head over to http://www.bing.com/explore/predicts.

38. Election Results and Predictions

Bing has had real-time election results for a while, but new this time are predictions. Check it out at http://www.bing.com/elections (or just search for elections). It breaks down results and predictions state-by-state, showing elections for the House, Senate, and Governorship.

Bing Elections

39. Find Seats to Local Events

Go to http://www.bing.com/events to find a list of major events in your area. You can filter by type of event (Music, Sports, etc.), city, date, and distance.

You can even submit your own events!

image27[1][2]

40. Language Translation

Bing can translate text for you. For example, I typed the query “translate thank you to italian” and it resulted in:

image57[1][2]

You can also go to http://www.bing.com/translator for more control over what you want translated.

Fun fact: Translation on Facebook is done via Bing:

image_thumb21_thumb

41. Provide feedback on the current query

On the result page, at the bottom, you can provide Feedback about the current query.

image_thumb55_thumb

This goes into a database that gets analyzed to suggest improvements for that query, or the system as a whole.

42. Links to Libraries

When you search for a book, you get a great sidebar, similar to that for songs or artists. Besides the usual links to buy the book, you also get a link to your local library to borrow an eBook version.

snowcrashOther interesting tidbits it gives you are the reading level and other books in the series.

43. Integration Into Windows

Performing a search on your Windows 8 computer shows results from your local computer as well as Bing, all in a seamless, integrated interface. It’s particularly effective on a Surface, with the touch interface.

44. Bing From Xbox One

You can use Bing without a keyboard. Without a mouse. Without a controller. Just your voice! If you have an Xbox One, you can do searches using voice commands, with natural, plain language, e.g., “Show me comedies starring Leslie Nielsen.”

Check out some examples and try them for yourself.

45. Bing is in Office

Bing is integrated into Microsoft Office. You can add Apps into Office that utilize Bing. You do this from the Insert tab on the Ribbon, under My Apps:

image_thumb69_thumb

You can also insert images into your document, directly from Bing (via Insert | Online Pictures:

image_thumb71_thumb

46. Cortana

http://ts4.mm.bing.net/th?id=HN.608053303690136121&pid=1.7

Cortana is awesome. You can have her record notes for you, remind you to do something at a specific time, search for something, even tell you a corny joke or sing a song.

The best part is that Cortana is powered by Bing and learns from your interests.

If you have Windows Phone, then you should definitely take some time to learn about how you can interact with Cortana.

(Sidebar: Do you wonder who Cortana really is?)

47. Bing Rewards

You can get points for each query you do, for specific tasks, for inviting friends, and more. With the points, you can redeem small prizes. I usually get enough Amazon gift certificates to get something decent every few months.

Go to http://www.bing.com/rewards to sign up, view your status, or redeem the points. Some of the gifts:

  • Xbox Live Gold Membership
  • Xbox Music Pass
  • Amazon gift cards
  • Windows Store gift cards
  • Skype credits,
  • OneDrive storage
  • Ad-free Outlook.com
  • Flowers
  • Restaurants
  • Movie tickets

By itself, the program isn’t going to change your life significantly, but it’s a nice little perk.

48. Bing is the Portal for your Microsoft Services

Above the photo, there is a bar with links to the most popular Microsoft destinations, including MSN, Outlook.Com, and Office Online.

image137[2]

49. High-Quality Partners

Microsoft has partnerships with many, many companies to ingest structured data from all over the world in many contexts. Some of the most obvious are Yelp and Trip Advisor. We also have partnerships with Twitter, Apple, Facebook, and many more.

50. Bing is the Portal to Your Day and the World

Yes, Bing is a search engine, and a GREAT one at that, but as demonstrated throughout this entire article, it does a lot more. By organizing and presenting the information in an attractive format, it aspires to be a lot more than just 10 blue links. You can learn and grow, find your information faster, explore related topics, answer your questions, and solve more problems. Bing is for people who want to experience the world.

It looks better, it performs better, it is awesome.


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

Almost 6 years at Microsoft…

I will have been at Microsoft for 6 years this fall. What an incredible journey I’m on. When I first joined, Bing was Live Search and was a totally different organization. It was a lot smaller. I think back then we could not even be called underdogs—Live Search just was not relevant. The progress we have made in the last few years has been nothing short of amazing. We have overtaken Google in some key areas, and the future is nothing but positive for us.

I have been working on the same team almost since I joined (I had two months on a team that was reorganized) and I could not have been luckier to land where I did, right in the heart of the query serving pipeline.

Since then, we’ve gone through some major redesign efforts and pushed out some amazing pieces of software to drive Bing (and many other parts of Microsoft). I became extremely familiar with .NET performance, and that has been key to my own personal success and that of my team’s. The challenges remain, and always will, which is a good nothing.

I work on a great team with some really smart people. I enjoy going to work almost every day. A few things bother me, but I love most of it. I really could not ask for anything better…


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

Announcing Writing High-Performance .NET Code

This blog has been silent for far too long. That’s because I’ve been heads-down on a side project for the last 10 months. I’d like to announce my latest technical book:

Writing High-Performance .NET Code

Cover-Tall-2000x2828

If you write managed code, you want this book. If you have friends who write managed code, they want this, even if they don’t know it yet.

Do you want your .NET code to have the absolute best performance it can? This book demystifies the CLR, teaching you how and why to write code with optimum performance. Learn critical lessons from a person who helped design and build one of the largest high-performance .NET systems in the world.

This book does not just teach you how the CLR works—it teaches you exactly what you need to do now to obtain the best performance today. It will expertly guide you through the nuts and bolts of extreme performance optimization in .NET, complete with in-depth examinations of CLR functionality, free tool recommendations and tutorials, useful anecdotes, and step-by-step guides to measure and improve performance.

Among the topics you will learn are how to:

  • Choose what to measure and why
  • Use many amazing tools, freely available, to solve problems quickly
  • Understand the .NET garbage collector and its effect on your application
  • Use effective coding patterns that lead to optimal garbage collection performance
  • Diagnose common GC-related issues
  • Reduce costs of JITting
  • Use multiple threads sanely and effectively, avoiding synchronization problems
  • Know which .NET features and APIs to use and which to avoid
  • Use code generation to avoid performance problems
  • Measure everything and expose hidden performance issues
  • Instrument your program with performance counters and ETW events
  • Use the latest and greatest .NET features
  • Ensure your code can run on mobile devices without problems
  • Build a performance-minded team

…and much more.

See http://www.writinghighperf.net for up-to-date information about the book. You can also like the Facebook page or subscribe to this blog to see updates.

The book is currently available via Amazon and Kobo. Barnes and Noble is pending. More retailers and formats will follow. See the Buy page to check for current availability.

I will also be posting some blog entries with topics inspired by the book, but weren’t quite a good fit.


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

First Bing.com commercial

Working on Bing.com for the last 9 months or so has been exhilarating. Finally, we can show the world the great stuff we’ve been doing. Here is (I think) the first TV commercial about Bing.com, running as of today.

I kissed Google goodbye more than a year ago and haven’t looked back. I think once people start using Bing, they’re going to do the same.


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

New apps and features from Live Search

I’ve been meaning to highlight a few of the cool things we’re doing in Live Search. I don’t have any direct involvement in the development of any of these—I just think they’re cool.

Answer Suggestions for IE8

IE8 is awesome, so go get it. Live Search has these things called Instant Answers where it can respond with succinct answers to your question, rather than just web pages that may have the answer. Good examples are weather and numeric conversions—you just want to know the answers, not necessarily follow links to find it.

You get normal search suggestions of course, but the cool thing is that the display of the instant answers is built right into IE8. You can type into the search box and have the answers returned right in the drop down as you type. Here are some samples:

Weather:answers_ie8_2 Solve math equations:

answers_ie8_1 There are a whole lot more kinds of answers. Maybe someday I’ll detail them.

Live Search Suggestions for Firefox

Firefox users haven’t been left out either. While there isn’t a full instant answers integration, Firefox does support search suggestions. You can download the plugin from the Firefox plugin directory.

firefox_live

Live Search for Windows Mobile

This is something I think really needs more publicity. I have a Samsung Saga i770, which I love. One of the first things I put on it was Live Search Mobile.

First of all, this thing has had speech recognition built-in since way before Google’s similar tools.

Easy to use, and optimized for your phone

It can easily find directions, gas prices, movies, traffics, maps, local businesses (by categories), and general web info. I use this app all the time.

There is custom software you can install for both Windows Mobile and Blackberry. It will work on the web for any other mobile phone that can get on the Internet.

And, by the way, it supports auto-suggest as well.

On your phone, you can go to wls.live.com to get it.

Related links:


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

Malware Detection in Live Search and Webmaster Tools

Live Search has recently released some great new features that I want to highlight. The first is from the Webmaster center, which is the team I was hired on.

With the new Webmaster Tools, you can now see which pages on your site are infected with malware (aka drive-by downloads). The links are clearly highlighted and disabled so that you won’t accidentally click on them.

webmaster_crawl_issues

Not only that, but you can also see what pages that your site links to are infected with malware. This is great if your site allows any user-generated content and it’s possible that some link spam has made it on.

webmaster_outbound_links

In addition to these improvements in Webmaster Tools, the general Live Search engine is using the same malware detection to notify users of bad pages in the general search results. To see this, click on the link as if to visit it and you’ll get a pop-up instead.

livesearch_malware

If you run your own site, get signed up in Webmaster Tools and make sure you’re not contributing to the malware problem. If you do find that your site has malware on it, once you’ve removed it you can request that your site be reanalyzed.

For more info, check out these other blogs and articles:


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

Girl from Mars – Magneta Lane

I first saw this video at the Microsoft Company Meeting 2008, and looked for the song everywhere, but couldn’t find the Magneta Lane version. They recorded it just for Microsoft. Nevertheless, the original Ash version is great too, so get that in the meantime.

Magneta’ Lane’s MySpace page does mention the song, and maybe a release is on the way.

Update: Forgot the music video from Ash. I like it.


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at:

On the importance of ignoring your problems

I’ve been having a great time at Microsoft over the last couple of months, but the ramp to full productivity is very steep. Recently, I’ve been working on an important improvement to some monitoring software, which requires a fairly good understanding of part of the system. It can be a little overwhelming trying to design something to handle all the nuances involved. Add to that the time crunch, and things get a little interesting. Last night, I ran into a little wall where I was uncertain about how to proceed. This kind of situation is always a little precarious. I was worried because today and tomorrow I have full-day training and won’t be able to dedicate a lot of time to solving this problem.

Half way through the training, while discussing something tangentially related to my problems, I realized the technical solution to the specific issue I was facing.

Sometimes you just need to ignore the problem for a while, and come back to it from a different angle.


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

Writing High-Performance.NET Code by Ben Watson. Available now in print and as an eBook at: