If the insert appears to be greater than O(n log n) then perhaps keeping a hash of the data and generating the order with a sort of the keys list might be faster...
Just a thought..
----
My mission: To boldy split infinitives that have never been split before!