Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            var config = new ShortRunWithMemoryDiagnoserConfig();

            Console.WriteLine(@"Choose an image resizing benchmarks:

0. Just run ""Load, Resize, Save"" once, don't benchmark
1. Resize
2. Load, resize, save
3. Load, resize, save in parallel

");
            switch (Console.ReadKey().Key)
            {
            case ConsoleKey.D0:
                try
                {
                    var lrs = new LoadResizeSave();
                    lrs.SystemDrawingBenchmark();
                    lrs.ImageSharpBenchmark();
                    if (RuntimeInformation.OSArchitecture is Architecture.X86 or Architecture.X64)
                    {
                        lrs.MagickBenchmark();
                    }
                    lrs.FreeImageBenchmark();
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        lrs.MagicScalerBenchmark();
                    }
                    lrs.SkiaBitmapBenchmark();
                    lrs.SkiaCanvasBenchmark();
                    lrs.NetVipsBenchmark();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                break;

            case ConsoleKey.D1:
                BenchmarkRunner.Run <Resize>(config);
                break;

            case ConsoleKey.D2:
                BenchmarkRunner.Run <LoadResizeSave>(config);
                break;

            case ConsoleKey.D3:
                // Only run the *Parallel benchmarks
                BenchmarkRunner.Run <LoadResizeSaveParallel>(config
                                                             .AddFilter(new NameFilter(name => name.EndsWith("Parallel"))));
                break;

            default:
                Console.WriteLine("Unrecognized command.");
                break;
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Console.WriteLine(@"Choose an image resizing benchmarks:

0. Just run ""Load, Resize, Save"" once, don't benchmark
1. Resize
2. Load, resize, save
3. Load, resize, save in parallel

");
            switch (Console.ReadKey().Key)
            {
            case ConsoleKey.D0:
                try
                {
                    var lrs = new LoadResizeSave();
                    lrs.SystemDrawingResizeBenchmark();
                    lrs.ImageSharpBenchmark();
                    lrs.MagickResizeBenchmark();
                    lrs.FreeImageResizeBenchmark();
                    lrs.MagicScalerResizeBenchmark();
                    lrs.SkiaBitmapLoadResizeSaveBenchmark();
                    lrs.SkiaCanvasLoadResizeSaveBenchmark();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                break;

            case ConsoleKey.D1:
                BenchmarkRunner.Run <Resize>();
                break;

            case ConsoleKey.D2:
                BenchmarkRunner.Run <LoadResizeSave>();
                break;

            case ConsoleKey.D3:
                BenchmarkRunner.Run <LoadResizeSaveParallel>();
                break;

            default:
                Console.WriteLine("Unrecognized command.");
                break;
            }
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            var config = ManualConfig.CreateEmpty()
                         .With(Job.Default.With(CsProjCoreToolchain.NetCoreApp11))
                         .With(DefaultConfig.Instance.GetLoggers().ToArray())
                         .With(DefaultConfig.Instance.GetColumnProviders().ToArray())
                         .With(MemoryDiagnoser.Default);

            Console.WriteLine(@"Choose an image resizing benchmarks:

0. Just run ""Load, Resize, Save"" once, don't benchmark
1. Resize
2. Load, resize, save
3. Load, resize, save in parallel

");
            switch (Console.ReadKey().Key)
            {
            case ConsoleKey.D0:
                var lrs = new LoadResizeSave();
                lrs.ImageSharpBenchmark();
                lrs.MagickResizeBenchmark();
                lrs.FreeImageResizeBenchmark();
                lrs.MagicScalerResizeBenchmark();
                lrs.SkiaBitmapLoadResizeSaveBenchmark();
                lrs.SkiaCanvasLoadResizeSaveBenchmark();
                break;

            case ConsoleKey.D1:
                BenchmarkRunner.Run <Resize>(config);
                break;

            case ConsoleKey.D2:
                BenchmarkRunner.Run <LoadResizeSave>(config);
                break;

            case ConsoleKey.D3:
                BenchmarkRunner.Run <LoadResizeSaveParallel>(config);
                break;

            default:
                Console.WriteLine("Unrecognized command.");
                break;
            }
        }
Exemplo n.º 4
0
 public void SkiaBitmapResizeBenchmark()
 {
     Parallel.ForEach(_images, image => {
         LoadResizeSave.SkiaBitmapLoadResizeSave(image, ThumbnailSize, _outputDirectory);
     });
 }
Exemplo n.º 5
0
 public void MagicScalerResizeBenchmark()
 {
     Parallel.ForEach(_images, image => {
         LoadResizeSave.MagicScalerResize(image, ThumbnailSize, _outputDirectory);
     });
 }
Exemplo n.º 6
0
 public void FreeImageResizeBenchmark()
 {
     Parallel.ForEach(_images, image => {
         LoadResizeSave.FreeImageResize(image, ThumbnailSize, _outputDirectory);
     });
 }
 public void SystemDrawingResizeBenchmark()
 {
     Parallel.ForEach(_images, image => {
         LoadResizeSave.SystemDrawingResize(image, ThumbnailSize, _outputDirectory);
     });
 }