Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize transform #21

Merged
merged 14 commits into from
Sep 6, 2016
Merged

Optimize transform #21

merged 14 commits into from
Sep 6, 2016

Conversation

anthonynsimon
Copy link
Owner

I optimized the Rotate function for special angles (for ex.: 90, 180, 270...), as these angles don't need supersampling when rotating. Now it performs much faster.

benchmark                   old ns/op      new ns/op      delta
BenchmarkRotation256-8      7858767        876950         -88.84%
BenchmarkRotation512-8      29263657       4050521        -86.16%
BenchmarkRotation1024-8     119374673      15880952       -86.70%
BenchmarkRotation2048-8     466060630      89323900       -80.83%
BenchmarkRotation4096-8     2033882420     388791904      -80.88%
BenchmarkRotation8192-8     8476689250     1663045960     -80.38%

benchmark                   old allocs     new allocs     delta
BenchmarkRotation256-8      21             7              -66.67%
BenchmarkRotation512-8      21             7              -66.67%
BenchmarkRotation1024-8     21             7              -66.67%
BenchmarkRotation2048-8     21             7              -66.67%
BenchmarkRotation4096-8     21             7              -66.67%
BenchmarkRotation8192-8     21             7              -66.67%

benchmark                   old bytes      new bytes     delta
BenchmarkRotation256-8      4457292        524540        -88.23%
BenchmarkRotation512-8      17826589       2097424       -88.23%
BenchmarkRotation1024-8     71303960       8388876       -88.24%
BenchmarkRotation2048-8     285213464      33554698      -88.24%
BenchmarkRotation4096-8     1140851480     134218001     -88.24%
BenchmarkRotation8192-8     4563403544     536871168     -88.24%

Also partly optimized the Resize function which is part of how supersampling is handled, so non-special angles should see a small performance increase. More optimizations should be made on that.

This closes #20

@anthonynsimon anthonynsimon merged commit a8d37d3 into master Sep 6, 2016
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.

Rotation of large images seems super slow.
1 participant