test.rb:

puts "hello world\n"

0.04s real, 1,403 syscalls, 12.83 MiB of disk space required

test.py:

print("hello world")

0.02s real, 1,202 syscalls, 151 MiB of disk space required

Show thread

test.c (glibc):

int puts(const char *s);

int main(int argc, char *argv[]) {
puts("hello world");
}

0s real, 67 syscalls, 46 MiB of disk space required (glibc cannot be statically linked) + 14 KiB for stripped binary

Show thread

test.c (musl libc):

int puts(const char *s);

int main(int argc, char *argv[]) {
puts("hello world");
}

0s real, 7 syscalls, 14 KiB of disk space required

Show thread

test.S (linux):

section .text
global _start
_start:
mov rdx, len
mov rsi, msg
mov rdi, 1
mov rax, 1
syscall

mov rdi, 0
mov rax, 60
syscall

section .rodata
msg: db "hello world", 10
len: equ $-msg

0s real, 2 syscalls, 8.5 KiB of disk space required

Size of the instructions + data without the ELF wrapper: 52 bytes

Show thread

@steph aye, which actually gets one too many syscalls but w/e

@sir

test.cr (musl libc)

puts "Hello World"

0s real, 183 syscalls, 867.2KiB for stripped binary

so, better than go, which is something

@espectalll @steph @sir

test.jl (linux, julia 1.3.0)

println("hello world")

0.44s real, 2080 syscalls, 360MB is the current unpacked size of julia

If we measure using the time macro (i.e. speed and resources at runtime) it is
0.002s real, 1.97KiB used

I hope I did this right. Can you tell it's not made for this?

@Vexatos @espectalll @steph how many unique syscalls? You can find out by trimming the first and last line out of the strace log and running this command:

cut -d'(' -f1 < trace | sort -u | wc -l

@Vexatos @espectalll @steph thanks! And can I have that unpacked julia size again, but in KiB?

@sir @espectalll @steph I just reran everything with latest julia (1.3.1).

test.jl (linux, julia 1.3.1)

println("hello world")

0.41s real, 1670 syscalls (42 unique), 344563 KiB

time macro outputs 0.002s, 1.98KiB

Follow

@sir @espectalll @steph The absolute number of syscalls seems to slightly fluctuate, but it is much lower with the updated version. The number of unique calls stays the same, as it should.

@sir @espectalll @steph aaaand it turns out I am an idiot, I forgot I had some weird julia config. Here are the numbers on an actually fresh system. Ignore everything above.... Sorry.

test.jl (linux, julia 1.3.1 and without silly configs)

println("hello world")

0.122s real, 913 syscalls (41 unique), 344563 KiB

time macro outputs 0.009s, 1.98KiB

Sign in to participate in the conversation
niu.moe

Welcome to your niu world ! We are a cute and loving international community O(≧▽≦)O !