I wrote a "count newlines" based on mapped files. It used about
twice the CPU of the version which just read 1 meg at a time. I
thought something was amiss (needless slice indirection or
something), so I wrote the code in C. It had the same CPU usage
as the D version. So...mapped files, not
On Thursday, 11 April 2024 at 00:24:44 UTC, Andy Valencia wrote:
I wrote a "count newlines" based on mapped files. It used
about twice the CPU of the version which just read 1 meg at a
time. I thought something was amiss (needless slice
indirection or something), so I wrote the code in C. It
On Thursday, 11 April 2024 at 14:54:36 UTC, Steven Schveighoffer
wrote:
For a repeatable comparison, you should provide the code which
does 1MB reads.
With pleasure:
import std.stdio : writeln, File, stderr;
const uint BUFSIZE = 1024*1024;
private uint
countnl(File f)
{
uint res = 0;
On Thursday, 11 April 2024 at 00:24:44 UTC, Andy Valencia wrote:
I wrote a "count newlines" based on mapped files. It used
about twice the CPU of the version which just read 1 meg at a
time. I thought something was amiss (needless slice
indirection or something), so I wrote the code in C. It
On Monday, 15 April 2024 at 08:05:25 UTC, Patrick Schluter wrote:
The setup of a memory mapped file is relatively costly. For
smaller files it is a net loss and read/write beats it hands
down.
Interestingly, this performance deficit is present even when run
against the largest conveniently av
On Thursday, 11 April 2024 at 16:23:44 UTC, Andy Valencia wrote:
[...]
void
main(in string[] argv)
^^
What if you want to use
bool memorymapped;
getopt (argv, "m", &memorymapped);
inside main? [1]
Have you tried using "rm" [2] instead of "r" as stdioOpenmode
under Linux
for a
On Monday, 15 April 2024 at 16:13:41 UTC, Andy Valencia wrote:
On Monday, 15 April 2024 at 08:05:25 UTC, Patrick Schluter
wrote:
The setup of a memory mapped file is relatively costly. For
smaller files it is a net loss and read/write beats it hands
down.
Interestingly, this performance defic