minotar/imgd — pull request #100 by LukeHandle (2014-12-07 06:26:21+00:00)
Title: GetBust Efficiency

As opposed to just cropping the GetBody, by manually rendering again we boost performance by quite a hefty degree (also a large improvement with the imaging.Crop).

With the original crop function (as used in the PR)
````
BenchmarkGetHead 500000 4829 ns/op
BenchmarkGetHelm 200000 7190 ns/op
BenchmarkGetBody 50000 30426 ns/op
BenchmarkGetBustOld 50000 45033 ns/op
BenchmarkGetBustNew 100000 18983 ns/op
````

With the imaging.Crop (as used in #97)
````
BenchmarkGetHead 5000000 637 ns/op
BenchmarkGetHelm 1000000 2829 ns/op
BenchmarkGetBody 200000 12230 ns/op
BenchmarkGetBustOld 100000 17920 ns/op
BenchmarkGetBustNew 200000 8227 ns/op
````

Unfortunately it results in slightly duplicated code (GetBust vs. GetBody). I expect there is a way to make it neater again if it's a big deal (might need some guidance though).