mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Ditched the use of modulo (%). Modulo is slow, and if you use it to just get the lower 8 bits (1 byte), you can just directly cast to byte. Also moved one if < out of the loop for speed. The less branching the better. Similarly replaced an if < 128 by cast to sbyte and taking its abs value. Performance gain in writing to PNG file seems to be roughly 20% (release mode, 1000x1000 bitmap). In ImageFramesCollectionTests I've set the culture to en-US to ensure getting english exception texts.af/merge-core
5 changed files with 80 additions and 2 deletions
Loading…
Reference in new issue