Skip to content

Conversation

@kleisauke
Copy link
Contributor

The native binaries for FreeImage are not available for Windows ARM64, so I excluded it from the benchmarks. Also, the benchmarks need to be built with portable debug symbols due to dotnet/roslyn#42393 and the NativeMemoryProfiler is unable to run on Windows ARM64 due to microsoft/perfview#1264.

This was tested using my Raspberry Pi 4B (4GB ram)1 with the prebuilt libvips binaries from https://github.com/libvips/build-win64-mxe/releases/tag/v8.10.2-build2. I intend to support Windows ARM64 within the NetVips.Native NuGet package for the next release.

Benchmark results:

BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
BCM2711 (ARM Cortex-A72), 1 CPU, 4 logical and 4 physical cores
.NET Core SDK=5.0.100
  [Host]       : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), Arm64 RyuJIT
  .Net 5.0 CLI : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), Arm64 RyuJIT

Job=.Net 5.0 CLI  Arguments=/p:DebugType=portable  Toolchain=.NET Core 5.0  
IterationCount=5  LaunchCount=1  WarmupCount=5  
|                    Method |      Mean |      Error |    StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
|-------------------------- |----------:|-----------:|----------:|------:|--------:|------:|------:|------:|----------:|
|   'System.Drawing Resize' | 59.160 ms | 21.3092 ms | 5.5339 ms |  1.00 |    0.00 |     - |     - |     - |     136 B |
|       'ImageSharp Resize' | 55.589 ms | 33.1113 ms | 8.5989 ms |  0.95 |    0.18 |     - |     - |     - |    8992 B |
|      'MagicScaler Resize' |  9.221 ms |  1.6021 ms | 0.2479 ms |  0.16 |    0.01 |     - |     - |     - |    2352 B |
| 'SkiaSharp Canvas Resize' | 14.113 ms |  4.0724 ms | 1.0576 ms |  0.24 |    0.03 |     - |     - |     - |    1424 B |
| 'SkiaSharp Bitmap Resize' | 13.972 ms |  1.2031 ms | 0.1862 ms |  0.24 |    0.02 |     - |     - |     - |     488 B |
|          'NetVips Resize' | 24.687 ms |  0.2549 ms | 0.0394 ms |  0.42 |    0.04 |     - |     - |     - |    4144 B |
|                                Method |       Mean |     Error |   StdDev | Ratio | RatioSD |     Gen 0 | Gen 1 | Gen 2 |  Allocated |
|-------------------------------------- |-----------:|----------:|---------:|------:|--------:|----------:|------:|------:|-----------:|
|   'System.Drawing Load, Resize, Save' | 1,339.5 ms |  33.36 ms |  8.66 ms |  1.00 |    0.00 |         - |     - |     - |   11.98 KB |
|       'ImageSharp Load, Resize, Save' | 1,627.4 ms |  38.12 ms |  9.90 ms |  1.22 |    0.01 | 3000.0000 |     - |     - | 1988.43 KB |
|      'MagicScaler Load, Resize, Save' |   410.2 ms |  54.97 ms | 14.28 ms |  0.31 |    0.01 |         - |     - |     - |  109.62 KB |
| 'SkiaSharp Canvas Load, Resize, Save' | 2,125.7 ms | 105.01 ms | 27.27 ms |  1.59 |    0.01 |         - |     - |     - |   95.95 KB |
| 'SkiaSharp Bitmap Load, Resize, Save' | 2,106.1 ms |  92.01 ms | 23.89 ms |  1.57 |    0.02 |         - |     - |     - |   83.77 KB |
|          'NetVips Load, Resize, Save' |   664.5 ms |  42.11 ms | 10.94 ms |  0.50 |    0.01 |         - |     - |     - |   47.53 KB |
|                                           Method |     Mean |     Error |   StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 |  Allocated |
|------------------------------------------------- |---------:|----------:|---------:|------:|--------:|------:|------:|------:|-----------:|
|   'System.Drawing Load, Resize, Save - Parallel' | 569.9 ms | 362.18 ms | 56.05 ms |  1.00 |    0.00 |     - |     - |     - |   24.13 KB |
|       'ImageSharp Load, Resize, Save - Parallel' | 604.7 ms | 238.97 ms | 62.06 ms |  1.08 |    0.18 |     - |     - |     - | 2001.97 KB |
|      'MagicScaler Load, Resize, Save - Parallel' | 139.9 ms |  64.97 ms | 10.05 ms |  0.25 |    0.04 |     - |     - |     - |   120.1 KB |
| 'SkiaSharp Canvas Load, Resize, Save - Parallel' | 719.5 ms | 168.89 ms | 26.14 ms |  1.27 |    0.16 |     - |     - |     - |  106.21 KB |
| 'SkiaSharp Bitmap Load, Resize, Save - Parallel' | 740.5 ms | 172.60 ms | 44.82 ms |  1.32 |    0.05 |     - |     - |     - |   94.11 KB |
|          'NetVips Load, Resize, Save - Parallel' | 296.0 ms |  84.41 ms | 21.92 ms |  0.54 |    0.08 |     - |     - |     - |   59.23 KB |

1: For a more realistic benchmark it would be nice to test it on a Surface Pro X as well. Does anyone have access to such device?

/cc @jcupitt, as he might be interested in the above numbers.

@jcupitt
Copy link

jcupitt commented Nov 16, 2020

Wow, well done MagicScaler!

I guess this is with the CopyMemory() change we discussed last week? Is Orc working on ARM?

@kleisauke
Copy link
Contributor Author

This is with the CopyMemory() only at the end and with caching disabled. Although it is compiled against orc, it seems that the C-path is used instead. Probably this is because https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/50 has landed recently and there is no new release available yet with that included.

I'll try to build against the orc master branch to see if it makes any difference.

@bleroy
Copy link
Owner

bleroy commented Nov 16, 2020

@kleisauke LMK if you need more time to get changes to this PR in or if you want me to merge it right away. Thanks for the contribution.

kleisauke added a commit to libvips/build-win64-mxe that referenced this pull request Nov 17, 2020
Since AArch64 support recently landed on the master branch.

See bleroy/core-imaging-playground#21
@kleisauke
Copy link
Contributor Author

@bleroy Feel free to merge. I'll do another PR if any of the above linked issues is resolved.

@jcupitt I had a go to build the ARM64 binaries against the orc master branch with commit libvips/build-win64-mxe@2c4c6ed. It seems that this does not cause a significant difference in the benchmarks. I also came across assertion failures while testing some utilities provided by orc (reported here), so that commit is not ready for production yet.

@bleroy
Copy link
Owner

bleroy commented Nov 17, 2020

That new patch file doesn't look like it should be in the commit.

@kleisauke
Copy link
Contributor Author

@bleroy Do you mean commit libvips/build-win64-mxe@2c4c6ed? That one is committed on the orc-master branch within the libvips/build-win64-mxe repository, so it is not included in this PR. It only refers to this PR within the commit message.

Sorry for the confusion.

@bleroy
Copy link
Owner

bleroy commented Nov 17, 2020

Oh yes, you're right, I got confused :)

@bleroy bleroy merged commit 94cc7c0 into bleroy:master Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants