Try further benchmarking what causes the slowness.  Isolate what code is 
causing the slowness itself.  Also, without knowing what hashRange and 
output contain, it is not obvious where the slowness comes from.  For 
instance if hashRange = {} and output = (0..1_000_000).to_a, this code 
takes relatively little time to execute.