AutoMapper 5.0 Released


Release notes:

Today I pushed out AutoMapper 5.0.1, the culmination of about 9 months of work from myself and many others to build a better, faster AutoMapper. Technically I pushed out a 5.0.0 package last week, but it turns out that almost nobody really pulls down beta packages to submit bugs so this package fixes the bugs reported from the 5.0.0 drop 🙂

The last 4.x release introduced an instance-based configuration model for AutoMapper, and with 5.0, we’re able to take advantage of that model to focus on speed. So how much faster? In our benchmarks, 20-50x faster. Compared to hand-rolled mappings, we’re still around 8-10x slower, mostly because we’re taking care of null references, providing diagnostics, good exception messages and more.

To get there, we’ve converted the runtime mappings to a single compiled expression, making it as blazing fast as we can. There’s still some micro-optimizations possible, which we’ll look at for the next dot release, but the gains so far have been substantial. Since compiled expressions give you zero stack trace if there’s a problem, we made sure to preserve all of the great diagnostic/error information to figure out how things went awry.

We’ve also expanded many of the configuration options, and tightened the focus. Originally, AutoMapper would do things like keep track of every single mapped object during mapping, which made mapping insanely slow. Instead, we’re putting the controls back into the developer’s hands of exactly when to use what feature, and our expression builder builds the exact mapping plan based on how you’ve configured your mappings.

This did mean some breaking changes to the API, so to help ease the transition, I’ve included a 5.0 upgrade guide in the wiki.

Enjoy!

AutoMapper 5.0 speed increases