3 ms·
In case performance is all you are after, this has much less potential for inlining than the rsync implementation has.
by blux 8y ago
In case performance is all you are after, this has much less potential for inlining than the rsync implementation has.
- vortico 8y agoTrue, but for rsync's case of setting the mtime of a file, performance of this logic is utterly insignificant.
- bayindirh 8y ago"Everything is fast for small n." -Knuth. While syncing some million files, I'm sure it'll have an impact tho. P.S.: Yes, we use it for a million files, regularly.
- blibble 8y agoit's probably not noticeable for a million files the syscall is going to be many, many orders of magnitude slower than the difference between a direct and an indirect call
- vortico 8y agoWith trivial method() functions, you could speed through that loop a million times in a millisecond.
- bayindirh 8y agoIIRC, switch statements bigger than a certain sizes are compiled to jump tables. So it's just a static jump after the code finds a working method. In theory, it's a very cheap piece of assembly after that point.