Again close to half of the time is spent copying arrays prior to alteration, but I've discussed this at length already.
Now, there is a way to improve the performance of the array copying. I think there might be an opportunity to shave some 20% off the execution time by implementing support for pure arrays (i.e. depth-1 arrays where all cells are the same type. This is because there are virtual calls on the Values in the array that is being dispatched on, once per cell. For pure arrays, the type can be checked once at the beginning, the elements downcasted using reinterpret_cast<>, which will avoid the virtual call.
I'm thinking that this could possibly be done simply by having an extra type indicator in the array class, that indicates if the array is pure, and if so, what type it contains.
Thoughts?
Regards,
Elias