private static void MeasureHandwritten() { Person person = Person.Create(); Stopwatch stopwatch = Stopwatch.StartNew(); for (int i = 0; i < Iterations; i++) { PersonDto personDto = MapHandwritten(person); } stopwatch.Stop(); Console.WriteLine("Handwritten: {0}ms", stopwatch.Elapsed.TotalMilliseconds); }
private static void MeasureAutoMapper() { Person person = Person.Create(); Mapper.CreateMap <Person, PersonDto>(); Stopwatch stopwatch = Stopwatch.StartNew(); for (int i = 0; i < Iterations; i++) { var personDto = Mapper.Map <PersonDto>(person); } stopwatch.Stop(); Console.WriteLine("AutoMapper: {0}ms", stopwatch.Elapsed.TotalMilliseconds); }