In Rust, sometimes the biggest performance overhead is repeated locking of
stdout. To avoid it, one would lock the stdout before the loop. I wonder Nim
requires locking as well.
{
let mut out = File::new("test.out");
let mut buf = BufWriter::new(out);
let mut lock = io::stdout().lock();
writeln!(lock, "{}", header);
for line in lines {
writeln!(lock, "{}", line);
writeln!(buf, "{}", line);
}
writeln!(lock, "{}", footer);
} // end scope to unlock stdout and flush/close buf
Run
- Nim's strutils.split() slower than Python's string split()? krtekz
- Re: Nim's strutils.split() slower than Python's string... juancarlospaco
- Re: Nim's strutils.split() slower than Python's st... mratsim
- Re: Nim's strutils.split() slower than Python'... krtekz
- Re: Nim's strutils.split() slower than Pyt... krtekz
- Re: Nim's strutils.split() slower tha... cblake
- Re: Nim's strutils.split() slower... adnan
- Re: Nim's strutils.split() sl... krtekz
- Re: Nim's strutils.split() sl... Araq
- Re: Nim's strutils.split() sl... kaushalmodi
- Re: Nim's strutils.split() sl... krtekz
- Re: Nim's strutils.split() sl... cblake
- Re: Nim's strutils.split() sl... ksandvik
- Re: Nim's strutils.split() sl... adnan
- Re: Nim's strutils.split() sl... krtekz
- Re: Nim's strutils.split() sl... adnan
- Re: Nim's strutils.split() sl... cblake
