[fpc-pascal] "Hello world" syscalls
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Thu Jan 9 00:30:48 CET 2020
On 07/01/2020 1:28 am, Vojtěch Čihák via fpc-pascal wrote:
> I found this article: https://drewdevault.com/2020/01/04/Slow.html
> but FPC is missing, so I wrote simple:
On a side note, and for comparison... According to that website, he/she
tested Java and got the following:
Lang Exec time Total syscalls Unique syscalls Size (KiB)
Java 0.07s real 226 26 15743KiB
So the resulting Java.class is 16 MByte in size!!! How?
I did the same on my system here with the latest OpenJDK 8 & 11.0.5. The
resulting size of the class file was identical with Java 8 & 11 and was
as follows:
$ javac -version
javac 1.8.0_232
$ javac Test.java
$ ls -l Test*
-rw-rw-r-- 1 graemeg graemeg 413 Jan 8 22:54 Test.class
-rw-rw-r-- 1 graemeg graemeg 115 Jan 8 22:53 Test.java
My resulting class file is only 413 bytes. So how does that website
owner get 16 MByte?
Regarding Execution time. It is interesting to note that Java 11 was on
avg 18.6% faster that Java 8.
As for the syscalls, not sure if I'm doing this right:
$ strace -C java Test
...snip....
% time seconds usecs/call calls syscall
98.51 0.006797 3399 2 futex
0.67 0.000046 2 21 mprotect
0.35 0.000024 24 1 clone
0.25 0.000017 9 2 munmap
0.13 0.000009 5 2 getpid
0.10 0.000007 0 27 mmap
0.00 0.000000 0 11 read
...snip...
------------------------------------------------------------
100.00 0.006900 198 total
That's 26 syscalls less than that website. It is interesting that 98% of
the time is spent with just two calls to futex. Clearly a very slow
syscall compared to the others.
Regards,
Graeme
More information about the fpc-pascal
mailing list