You can get another 2x speedup if you choose the pivot better. Right now it seems you're doing median of 3.
When you're doing Order Statistics (ie Selection/Quickselect) with 1M elements you should be very very close to the theoretical optimum (1.5N) for complexity. See my comment here:
https://news.ycombinator.com/item?id=6629117
If you're interested in choosing the best strategy.
HTH