WIP improvements made so far in the gif encoder. All the time/memory usage is in the OctreeQuantizer.cs
I don't know what quantizer System.Drawing
uses (Most likely a fixed palette with pre-dithering)
but the quality difference is incomparable.
It'll probably take a better mind than mine to bring the memory usage in the quantizer down further.
P.S ArrayPool<T>
rocks!!!
Before
Method | Mean | StdDev | Scaled | Scaled-StdDev | Gen 0 | Allocated |
---|---|---|---|---|---|---|
'System.Drawing Gif' | 13.5993 ms | 0.4928 ms | 1.00 | 0.00 | - | 1.12 MB |
'ImageSharp Gif' | 75.0405 ms | 2.1495 ms | 5.52 | 0.24 | 2645.8333 | 17.96 MB |
After
Method | Mean | StdErr | StdDev | Scaled | Scaled-StdDev | Gen 0 | Gen 1 | Allocated |
---|---|---|---|---|---|---|---|---|
'System.Drawing Gif' | 14.7249 ms | 0.1580 ms | 0.9866 ms | 1.00 | 0.00 | - | - | 1.12 MB |
'ImageSharp Gif' | 75.0355 ms | 0.4332 ms | 1.6777 ms | 5.12 | 0.34 | 1187.5000 | 312.5000 | 9.22 MB |
New After Massive improvement after removing boxing allocations.
Method | Mean | StdDev | Scaled | Scaled-StdDev | Allocated |
---|---|---|---|---|---|
'System.Drawing Gif' | 20.2133 ms | 1.1400 ms | 1.00 | 0.00 | 1.12 MB |
'ImageSharp Gif' | 86.3056 ms | 0.8807 ms | 4.28 | 0.23 | 2.74 MB |