6.3.2 Text_IO Suggestions

The Ada.Text_IO package has fairly high overhead due in part to the requirement of maintaining page and line counts. If performance is critical, one recommendation is to use Stream_IO instead of Text_IO for large-volume output, since it has less overhead.

If you must use Text_IO, note that output to the standard output and standard error files is unbuffered by default (this provides better behavior when output statements are used for debugging or if the progress of a program is observed by tracking the output, e.g. by using the Unix ‘tail -f’ command to watch redirected output).

If you’re generating large volumes of output with Text_IO and performance is an important factor, use a designated file instead of the standard output file or change the standard output file to be buffered using Interfaces.C_Streams.setvbuf.