News for hackers. Stuff that matters.
Re:A fun optimization trick from rsync by vortico on Monday October 29, 2018 @04:09AM (#18325760)
True, but for rsync's case of setting the mtime of a file, performance of this logic is utterly insignificant.
Re:A fun optimization trick from rsync by bayindirh on Monday October 29, 2018 @07:41AM (#18326631)
"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.

Re:A fun optimization trick from rsync by blibble on Monday October 29, 2018 @07:48AM (#18326676)
it'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

Re:A fun optimization trick from rsync by bayindirh on Monday October 29, 2018 @02:40PM (#18330008)
IIRC, 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.

Re:A fun optimization trick from rsync by vortico on Monday October 29, 2018 @12:04PM (#18328593)
With trivial method() functions, you could speed through that loop a million times in a millisecond.