muesli/smartcrop — pull request #9 by tuvistavie (2014-10-25 17:32:03+00:00)
Title: Use normal multiplication instead of exponentiaion for pow 2 case.

[`math.Pow` is quite heavy](http://golang.org/src/pkg/math/pow.go?s=1186:1216#L28) and wastes a lot of time while computing the score.
Replacing it by a simple multiplication reduces time by almost 2.

These are the results I got for a 598x900 pixels image with an i7 processor.

With `math.Pow`:

```sh
$ ./foo
0.46451133407655143
original resolution: 598x900
scale: 2.392000, cropw: 277.000000, croph: 277.000000, minscale: 0.900000
Time elapsed edge: 48.715635ms
Time elapsed skin: 69.20784ms
Time elapsed sat: 29.168815ms
Time elapsed crops: 57.868us 102
Time elapsed score: 2.086053949s
```

With `x * x`:

```sh
$ ./foo
0.46451133407655143
original resolution: 598x900
scale: 2.392000, cropw: 277.000000, croph: 277.000000, minscale: 0.900000
Time elapsed edge: 47.328424ms
Time elapsed skin: 32.094467ms
Time elapsed sat: 29.98ms
Time elapsed crops: 52.197us 102
Time elapsed score: 1.051735309s
```