Re: Pretty Print

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andy Serpa writes:
> The only thing I don't like is that it outputs one bit at a time, which 
> on a Windows console takes forever. 
> It is like my old 1200 baud modem.

I'm using a 1.8GHz machine, so I've become somewhat insensitive
to speed issues.  smile

To see your problem, I booted up my old 150MHz machine and, yes,
it does print slowly on a Windows console. It's because of a horrible
kludge that Microsoft did. Printing a line at a time is much faster
than printing a character at a time, because for each I/O operation 
Microsoft switches to a different *process* to print on the console.
Then they switch back. It's really inefficient compared to printing
text on a normal "Windows" window, or printing to a file, or printing
on the screen with a DOS program (ex.exe).

> I added a global sequence "output" which is cleared when pretty_print is 
> called, added to by pretty_out (replacing the puts there) and then added 
> a single puts(pretty_file,output) at the very end of the procedure 
> (after the rPrint).  Much faster that way, although you've got to buffer 
> the whole output in memory first.  Worth it I think.

I don't think you'll gain anything by buffering multiple lines at one time,
and your buffer could get very large. I added a few lines of code
to do one-line-at-a-time buffering. That speeds things up quite a bit.

Thanks,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu