News for hackers. Stuff that matters.
Re:FasterPath: Faster Pathname Handling for Ruby Written in ... by bjourne on Friday June 17, 2016 @02:31PM (#11924561)
How on earth can pathname handling be a performance drag? If I read his stats correctly, then `Pathname#chop_basename` is called 24456 times for one page load. Something is very fishy about that.
Re:FasterPath: Faster Pathname Handling for Ruby Written in ... by viraptor on Friday June 17, 2016 @05:10PM (#11925573)
Agree, and that's per actual page load. Not at the start of the app. If there's no dynamic searching for paths in the app, I don't understand why there would be even one path operation done after the first request. Templates, extra resources, etc. - you can optimise this down to assembler, but it's always going to take time. What solves this is just caching the results - you don't run the path operations anymore.
Re:FasterPath: Faster Pathname Handling for Ruby Written in ... by ape4 on Friday June 17, 2016 @05:58PM (#11925809)
Exactly what I was thinking. You look for the last slash and truncate.
Re:FasterPath: Faster Pathname Handling for Ruby Written in ... by ugexe on Friday June 17, 2016 @07:18PM (#11926131)
This is a naive solution. Try using that on windows.
Re:FasterPath: Faster Pathname Handling for Ruby Written in ... by ajmurmann on Friday June 17, 2016 @08:23PM (#11926359)
This actually makes me wonder if it would be worthwhile to look for this and similar issues and remove Windows support from the methods for a custom implementation. It might shave off some more time.
Re:FasterPath: Faster Pathname Handling for Ruby Written in ... by ape4 on Friday June 17, 2016 @09:31PM (#11926560)
Still, use a pattern to find the last slash or backslash. Should be pretty quick.