What makes vibe.d Incredibly Slow on a VPS?

Steven Schveighoffer schveiguy at gmail.com
Sat Mar 18 22:47:06 UTC 2023


On 3/18/23 9:36 AM, seany wrote:

> But on a VPS server, the program outputs the first writeln line (not 
> even the consequent req.form printouts), then apparently stops for 
> several seconds ( 10 to 16) , and then suddenly starts working again. I 
> see this in the log outputs.
> 
> Why does this happen? How can I start debugging?

Before getting into it any further, try flushing output after every writeln.

This is true in D and C too -- if your `stdout` stream is connected to a 
log file, it will *not* flush upon every newline. However, if it's 
connected to a terminal, it *will* flush upon every newline.

It's possible it is running just as fast as you expect, but the buffered 
output has not yet been flushed.

So just add `stdout.flush()` after every `writeln` call and see if it 
helps. If not, then it needs more investigation.

-Steve


More information about the Digitalmars-d-learn mailing list