Pay as you go is really going to make a difference
Jacob Carlborg
doob at me.com
Fri Jan 24 20:29:36 UTC 2020
On 2020-01-24 10:52, Johan Engelen wrote:
> Indeed. Also to figure out why LDC's binary calls 31 more than DMD's
> binary.
> Much appreciated if someone could repeat the test and post a list of all
> syscalls being made.
Not exactly the same as the original post, but here's some data I pulled
out for macOS 10.14.6 with a Hello World compiled with DMD 2.088.0. This
should give somewhat of an idea what's going on in the application. I've
included the stacktrace for all syscalls NOT made by the system.
As you can see below, 10 calls are made by the application, all of the
remaining calls are made by the system itself. Most of the calls made by
the system are made by the dynamic loader. Only three calls originate
from the D main function. Only one call into the C standard library is
made from the D main function, which is the call to `fwrite`.
It's not our fault that the system does so many calls :).
total: 120, system: 110, app: 10
stat64, total: 40, system: 40, app: 0
-----------------------------------------------
mach_vm_map_trap, total: 8, system: 6, app: 2
6 libsystem_malloc.dylib malloc
7 foobar
_D2rt5minfo11ModuleGroup9sortCtorsMFAyaZ6doSortMFmKAPyS6object10ModuleInfoZb
8 foobar _D2rt5minfo11ModuleGroup9sortCtorsMFAyaZv
9 foobar _D2rt5minfo11ModuleGroup9sortCtorsMFZv
10 foobar
_D2rt5minfo13rt_moduleCtorUZ14__foreachbody1MFKSQBu19sections_osx_x86_6412SectionGroupZi
11 foobar rt_moduleCtor
12 foobar rt_init
13 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
14 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
15 foobar _d_run_main2
16 foobar _d_run_main
17 foobar main
18 libdyld.dylib start
10 libsystem_c.dylib fwrite
11 foobar
_D3std5stdio__T13trustedFwriteTaZQsFNbNiNePOS4core4stdcQBx7__sFILExAaZm
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:4322
12 foobar _D3std5stdio4File17LockingTextWriter__T3putTAyaZQjMFNfMQlZv
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:2930
13 foobar _D3std5stdio__T7writelnTAyaZQnFNfQjZv
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:3855
14 foobar _Dmain ~/development/d/main.d:15
15 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZ9__lambda1MFZv
16 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
17 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
18 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
19 foobar _d_run_main2
20 foobar _d_run_main
21 foobar main
22 libdyld.dylib start
-----------------------------------------------
mprotect, total: 8, system: 8
mach_port_deallocate_trap, total: 4, system: 4
-----------------------------------------------
sigaction, total: 4, system: 0, app: 4
0 libsystem_kernel.dylib __sigaction
1 libsystem_platform.dylib __platform_sigaction
2 foobar runModuleUnitTests
3 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
4 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
5 foobar _d_run_main2
6 foobar _d_run_main
7 foobar main
8 libdyld.dylib start
-----------------------------------------------
mach_reply_port, total: 4, system: 4, app: 0
host_self_trap, total: 3, system: 3, app: 0
mach_port_mod_refs_trap, total: 3, system: 3, app: 0
ioctl, total: 3, system: 3, app: 0
mach_port_construct_trap, total: 3, system: 3, app: 0
kdebug_typefilter, total: 2, system: 2, app: 0
thread_self_trap, total: 2, system: 2, app: 0
proc_info, total: 2, system: 2, app: 0
mach_port_destruct_trap, total: 2, system: 2, app: 0
csops, total: 2, system: 2, app: 0
getpid, total: 2, system: 2, app: 0
task_self_trap, total: 2, system: 2, app: 0
access, total: 1, system: 1, app: 0
close, total: 1, system: 1, app: 0
shared_region_check_np, total: 1, system: 1, app: 0
-------------------------------------------------------
fstat64, total: 1, system: 0, app: 1
5 libsystem_c.dylib fwrite
6 foobar
_D3std5stdio__T13trustedFwriteTaZQsFNbNiNePOS4core4stdcQBx7__sFILExAaZm
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:4322
7 foobar _D3std5stdio4File17LockingTextWriter__T3putTAyaZQjMFNfMQlZv
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:2930
8 foobar _D3std5stdio__T7writelnTAyaZQnFNfQjZv
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:3855
9 foobar _Dmain ~/development/d/main.d:15
10 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZ9__lambda1MFZv
11 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
12 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
13 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
14 foobar _d_run_main2
15 foobar _d_run_main
16 foobar main
17 libdyld.dylib start
-----------------------------------------------
mac_vm_allocate_trap, total: 1, system: 1, app: 0
open, total: 1, system: 1, app: 0
mac_syscall, total: 1, system: 1, app: 0
-----------------------------------------------
sysctl, total: 1, system: 0, app: 1
3 libsystem_c.dylib sysconf
4 foobar _D4core6thread26_sharedStaticCtor_L3685_C1FZv
5 foobar _D4core6thread15__modsharedctorFZv
6 foobar
_D2rt5minfo__T14runModuleFuncsSQBdQBd11ModuleGroup8runCtorsMFZ9__lambda2ZQChMFAxPyS6object10ModuleInfoZv
7 foobar _D2rt5minfo11ModuleGroup8runCtorsMFZv
8 foobar
_D2rt5minfo13rt_moduleCtorUZ14__foreachbody1MFKSQBu19sections_osx_x86_6412SectionGroupZi
9 foobar rt_moduleCtor
10 foobar rt_init
11 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
12 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
13 foobar _d_run_main2
14 foobar _d_run_main
15 foobar main
16 libdyld.dylib start
-----------------------------------------------
getentropy, total: 1, system: 1, app: 0
issetugid, total: 1, system: 1, app: 0
bsdthread_register, total: 1, system: 1, app: 0
-----------------------------------------------
write_nocancel, total: 1, system: 0, app: 1
0 libsystem_kernel.dylib __write_nocancel
1 libsystem_c.dylib _swrite
2 libsystem_c.dylib __sflush
3 libsystem_c.dylib fflush
4 foobar _d_run_main2
5 foobar _d_run_main
6 foobar main
7 libdyld.dylib start
-----------------------------------------------
exit, total: 1, system: 1, app: 0
-----------------------------------------------
getrlimit, total: 1, system: 0, app: 1
8 libsystem_c.dylib fwrite
9 foobar
_D3std5stdio__T13trustedFwriteTaZQsFNbNiNePOS4core4stdcQBx7__sFILExAaZm
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:4322
10 foobar _D3std5stdio4File17LockingTextWriter__T3putTAyaZQjMFNfMQlZv
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:2930
11 foobar _D3std5stdio__T7writelnTAyaZQnFNfQjZv
~/.dvm/compilers/dmd-2.088.0/osx/bin/../../src/phobos/std/stdio.d:3855
12 foobar _Dmain ~/development/d/main.d:15
13 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZ9__lambda1MFZv
14 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
15 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv
16 foobar _D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv
17 foobar _d_run_main2
18 foobar _d_run_main
19 foobar main
20 libdyld.dylib start
-----------------------------------------------
mach_timebase_info, total: 1, system: 1, app: 0
sysctlbyname, total: 1, system: 1, app: 0
csrctl, total: 1, system: 1, app: 0
thread_selfid, total: 1, system: 1, app: 0
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list