Skip to content

Commit

Permalink
Flush stdout after outputting debug message
Browse files Browse the repository at this point in the history
TextIO.output() doesn't flush stdout, but print() does. Flushing is
necessary to make sure the messages are printed in a timely fashion,
which is important when debugging timing/performance issues.

The performance hit of the extra flushing should be negligible, as
even when these debug messages are enabled, they are only printed a
few dozen times or so.
  • Loading branch information
someplaceguy committed Oct 29, 2023
1 parent 5196d64 commit 08b9953
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools-poly/poly/poly-init2.ML
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ local
val meta_debug = ref false

fun MDBG s = if !meta_debug then
TextIO.output(TextIO.stdOut, "META_DEBUG: " ^ s() ^ "\n")
TextIO.print("META_DEBUG: " ^ s() ^ "\n")
else ()

infix ++
Expand Down

0 comments on commit 08b9953

Please sign in to comment.