How to do a lightweight and fast depth sorting of (many) displayObjects?

How can I modify the draw order within a displayGroup without doing a full sort and rebuild the whole display group each frame?

My use case is, I have many sprites/entities and need to sort them so they’re rendered in the right order and I have to do this each frame as many of them are moving around constantly and so does their sort order.

The good thing is, I can update this order quite good by just doing tiny adjustments, i.e. it’s usually just entities close to each other that have to be swapped so I can do this in linear time using a single iteration over all the objects per frame and just swap those who changed their depth relative to their (depth)“neighbors”. I tried to swap the children of the display group but it seems, this does not change the drawing order in any way.

toFront()/toBack() don’t help either as this requires a complete sort of all my entities which can become much more costly than just a single iteration over the entities and the complexity does of course not increase linearly with the number of objects to sort (the way I do/want to do the sorting, I could even distribute the sorting over multiple frames, not an option with toFront()/toBack().