private static long BenchOoMapper(int mappingsCount) { var s = new BenchSource(); var d = new BenchDestination(); return(Benchmark(mappingsCount, () => d = Mapper.Map(s, d))); }
static long BenchHandwrittenMapper(int mappingsCount) { var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { d = Map(s, d); } sw.Stop(); return(sw.ElapsedMilliseconds); }
static long BenchBLToolkit2(int mappingsCount) { var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { BLToolkit.Mapping.Map.ObjectToObject<BenchDestination>(s); d = BLToolkit.Mapping.Map.ObjectToObject<BenchDestination>(s); } sw.Stop(); return sw.ElapsedMilliseconds; }
private static BenchDestination.Int1 Map(BenchSource.Int1 s, BenchDestination.Int1 d) { if (s == null) { return null; } if (d == null) { d = new BenchDestination.Int1(); } d.i = s.i; d.str1 = s.str1; d.str2 = s.str2; return d; }
static long BenchBLToolkit2(int mappingsCount) { var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { BLToolkit.Mapping.Map.ObjectToObject <BenchDestination>(s); d = BLToolkit.Mapping.Map.ObjectToObject <BenchDestination>(s); } sw.Stop(); return(sw.ElapsedMilliseconds); }
static long BenchEmitMapper(int mappingsCount) { var mapper = ObjectMapperManager.DefaultInstance.GetMapper <BenchSource, BenchDestination>(); var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { mapper.Map(s, d); } sw.Stop(); return(sw.ElapsedMilliseconds); }
static long BenchAutoMapper(int mappingsCount) { AutoMapper.Mapper.CreateMap<BenchSource.Int1, BenchDestination.Int1>(); AutoMapper.Mapper.CreateMap<BenchSource.Int2, BenchDestination.Int2>(); AutoMapper.Mapper.CreateMap<BenchSource, BenchDestination>(); var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { AutoMapper.Mapper.Map(s, d); } sw.Stop(); return sw.ElapsedMilliseconds; }
static long BenchAutoMapper(int mappingsCount) { AutoMapper.Mapper.CreateMap <BenchSource.Int1, BenchDestination.Int1>(); AutoMapper.Mapper.CreateMap <BenchSource.Int2, BenchDestination.Int2>(); AutoMapper.Mapper.CreateMap <BenchSource, BenchDestination>(); var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { AutoMapper.Mapper.Map(s, d); } sw.Stop(); return(sw.ElapsedMilliseconds); }
private static BenchDestination.Int2 Map(BenchSource.Int2 s, BenchDestination.Int2 d) { if (s == null) { return null; } if (d == null) { d = new BenchDestination.Int2(); } d.i1 = Map(s.i1, d.i1); d.i2 = Map(s.i2, d.i2); d.i3 = Map(s.i3, d.i3); d.i4 = Map(s.i4, d.i4); d.i5 = Map(s.i5, d.i5); d.i6 = Map(s.i6, d.i6); d.i7 = Map(s.i7, d.i7); return d; }
static BenchDestination Map(BenchSource s, BenchDestination d) { if (s == null) { return(null); } if (d == null) { d = new BenchDestination(); } d.i1 = Map(s.i1, d.i1); d.i2 = Map(s.i2, d.i2); d.i3 = Map(s.i3, d.i3); d.i4 = Map(s.i4, d.i4); d.i5 = Map(s.i5, d.i5); d.i6 = Map(s.i6, d.i6); d.i7 = Map(s.i7, d.i7); d.i8 = Map(s.i8, d.i8); d.n2 = s.n2; d.n3 = s.n3; d.n4 = s.n4; d.n5 = s.n5; d.n6 = s.n6; d.n7 = s.n7; d.n8 = s.n8; d.n9 = s.n9; d.s1 = s.s1; d.s2 = s.s2; d.s3 = s.s3; d.s4 = s.s4; d.s5 = s.s5; d.s6 = s.s6; d.s7 = s.s7; return(d); }
private static BenchDestination Map(BenchSource s, BenchDestination d) { if (s == null) { return null; } if (d == null) { d = new BenchDestination(); } d.i1 = Map(s.i1, d.i1); d.i2 = Map(s.i2, d.i2); d.i3 = Map(s.i3, d.i3); d.i4 = Map(s.i4, d.i4); d.i5 = Map(s.i5, d.i5); d.i6 = Map(s.i6, d.i6); d.i7 = Map(s.i7, d.i7); d.i8 = Map(s.i8, d.i8); d.n2 = s.n2; d.n3 = s.n3; d.n4 = s.n4; d.n5 = s.n5; d.n6 = s.n6; d.n7 = s.n7; d.n8 = s.n8; d.n9 = s.n9; d.s1 = s.s1; d.s2 = s.s2; d.s3 = s.s3; d.s4 = s.s4; d.s5 = s.s5; d.s6 = s.s6; d.s7 = s.s7; return d; }
static long BenchEmitMapper(int mappingsCount) { var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { emitMapper.Map(s, d); } sw.Stop(); return sw.ElapsedMilliseconds; }
static long BenchEmitMapper(int mappingsCount) { var mapper = ObjectMapperManager.DefaultInstance.GetMapper<BenchSource, BenchDestination>(); var s = new BenchSource(); var d = new BenchDestination(); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < mappingsCount; ++i) { mapper.Map(s, d); } sw.Stop(); return sw.ElapsedMilliseconds; }
private static long BenchOoMapper(int mappingsCount) { var s = new BenchSource(); var d = new BenchDestination(); return Benchmark(mappingsCount, () => d = Mapper.Map(s, d)); }