I don't think this is a limitation of Tk 9.  I think it is a limitation
of Apple's CoreGraphics.  Both Tk 8 and Tk 9 use CGContextDrawImage and
that is where the time is being spent in the testmage command.

However there are still many aspects of what you are saying that I do not
understand or that are incomplete.

1.  You have never said what "simulation code nim" means.  So I do not know
what you are comparing against the testimage code.  It appears on the
surface that you may be comparing apples and oranges.

2. The testimage code that I attached will compile as an 8.6 extension,
but it will not update the screen under 8.6.  I know the reason from my
instrumentation: the calls to XPutImage are being made outside of drawRect.
This is a serious limitation of 8.6.  Drawing operations often have to be
repeated because they are attempted outside of drawRect, which (after
macOS 10.14) means that it is impossible to obtain a valid CGContextRef
because the window's contentView is not the focusView.  You see this in
practice as a return value of BadDrawable, as you reported.  The testimage
code has no mechanism for calling XPutImage a second time if the first
attempt fails due to the contentView not being the focusView.  So it
couldn't possibly work with Tk 8.

3. A consequence of (2) is that whatever code you may be using to compare
Tk 8 against Tk 9 (and you still haven't said what that is) it can't
possibly work the same way as the testimage code.  Maybe that just means
that the testimage command is not testing the right thing.

In any case, if there is any way for me to see a comparison of working
Tk 8 code versus working Tk 9 code where the Tk 8 code is significantly
faster, then I would be very interested and it would be very helpful to
me.  But so far I haven't seen anything like that.