Pay as you go is really going to make a difference
norm
norm.rowtree at gmail.com
Sat Jan 25 23:41:29 UTC 2020
On Saturday, 25 January 2020 at 16:07:24 UTC, Steven
Schveighoffer wrote:
> On 1/24/20 5:20 PM, Gregor Mückl wrote:
>
>> So there's a couple of calls that should be fairly fast
>> (clock_getres etc.). Why does the runtime need to read
>> /proc/self/maps, though?
>
> This is great stuff, thanks!
>
> Note that /proc/self/maps appears nowhere in phobos or
> druntime. So I'm assuming that's some other function that's
> doing it (maybe in libc?)
>
> The clock_getres calls are so you can use core.time.MonoTime.
> rt_init initializes those so they can be used early in the
> process. I would assume those are really fast, as they are
> constants in the kernel.
>
> -Steve
I was curious so I ran a quick strace hello world experiment
using only printf, not writeln, compiled with D (DMD), C++ and C
(gcc and clang). Only the D binary opens /proc/self/maps. Running
`strace dmd --version` also opens /proc/self/maps, but I guess
that makes sense since the compiler itself is now written in D.
===
// D hello world
import core.stdc.stdio;
int main() {
printf("Hello world\n");
return 0;
}
// CC and C hello world
#include <stdio.h>
int main() {
printf("Hello world\n");
return 0;
}
===
Cheers,
Norm
More information about the Digitalmars-d
mailing list