Some performance improvements

Hi,

Thanks for share this excellent concept.

I made some performance improvements just with this changes the performances a 10%. (more or less) over a 10 times iteration, before was 4.70 now is 4.10 in my box.

And too i changed the fixed path "/tmp/image" by a random file, to avoid a race condition.

I hope you enjoy it.

Regards