Optimization and flushing the interpreter

Is there a unified way to flush buffered text to the interpreter or is in implementation-dependent? If I ran an expensive calculation I’d like to print a message beforehand to tell the user the story hasn’t crashed, but buffering is causing it to appear after the calculation has finished. (I’m using the version of Git included with Gnome Inform 7.)

Anyway, I was procrastinating from doing actual writing and wrote a random name generator, but the initial computations are quite slow. It uses a table of lists as a multimap, which is probably most of the problem. Does anyone have extension for an associative data structure lying around, or would I need to roll my own? Also, is it possible to view the i6 intermediate representation of the code?

Thanks again!

To answer the last of those: look at the file auto.inf in your project’s Build directory after compiling. That’s the I6 code used to make your story.

The only general way to flush output is to wait for input. If you do a wait-for-keystroke, that pushes out all the display updates.

It also suffices to set a timer and wait for it to fire – timer events count as input. A very short timer will do. But it’s best to accept either a keystroke or timer event, since the interpreter might not support both.