I am under the assumption if I implement efficient algorithm that does not require a lot of disk access - that should show up in before and after output in strace.
To verify that my hypothesis, and I testing out strace on the following simple program.
open("test", "wb", buffering=0).close()
print("hello")
Here is the strace output,
# strace -e trace=write,open,close -o trace.txt python3 -c 'open("test", "wb", buffering=0).close(); print("hello")'
hello
# cat trace.txt
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(4) = 0
close(4) = 0
close(4) = 0
close(4) = 0
close(4) = 0
close(3) = 0
close(3) = 0
close(3) = 0
write(1, "hello\n", 6) = 6
+++ exited with 0 +++
The final write syscall makes sense, but what is triggering these preceding close(3) syscall calls? I am aware that 3 and 4 indicates some file descriptors used by my program.
Thank you in advance!