I'm not sure what you mean by flushing in the middle of the line.   
fprintf(stderr)  is supposed to be unbuffered (flush after every call), and 
fprintf(stdout) should be buffered.  fflush(stdout) is the typical approach 
to turning stdout to the same behavior as stderr.   A typical printf line 
is the following.

printf("\nSomeText\n\n").   You definitely don't want three flushes from 
that.   I typically avoid direct use of printf in code, and wrap log 
statements around printf.  That way the logs can optionally flush 
(especially on warnings/errors), but buffer the rest of the outputs, and 
provide coloring to specific log types.  You'd be surprised at how log 
statements can bring down performance especially when you are shooting for 
60 fps.

On Friday, October 31, 2014 11:41:13 AM UTC-7, jj wrote:
>
> Can you point to a reference on how the flushing should work then? Note 
> that printing to a web console is line-based, so there is no way to flush 
> without inserting a newline at the same time, which is why flushing is 
> implemented at newline boundaries to preserve correct output. Flushing in 
> the middle of a line would cause incorrect printing, and I don't think 
> there is a performance benefit in flushing more seldomly either - that 
> would just lead to more potential confusion.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to