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
Follow

@sir
don't forget to add the size of kernel

Sign in to participate in the conversation
niu.moe

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