Hey!
exAspArk
2

Thanks. Those times are actually in us (microseconds)not ns. You may think of creating forks as twice the effort of creating threads, or you could see it as it taking only extra 10us to fork when compared to creating a new thread. But this doesn’t explain why it’s so much slower in Ruby. It’s about 100 times slower to fork in MRI when compared to spawning a new thread, I mean, it’s not twice slower either. Given Ruby’s significant overhead I’d expect less than twice if we only consider the OS syscalls. I’d expect about the same performance actually. I suspect this may be related to Ruby GC taking place after forking, which would mess up with the CoW I guess. I really don’t know the reason, but I’d love to understand why forking is 100 times slower in Ruby when the syscalls take pretty much about the same (10us only in difference) and are both pretty fast.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.