Articles like this one, and the recent project on libraries like Helix http://blog.skylight.io/introducing-helix/ make me awfully tempted to rewrite inner loops in certain production Ruby projects in Rust.
Re Sprockets, I found this recent talk at RailsConf about the history, problems, and future of Sprockets maintenance and development to be an interesting read: http://schneems.com/2016/05/31/saving-sprockets.html
I don't write Rust either, but I might guess that they are trying to unbox a nullable value that can't be null. They need a default string due to Rusts strong types even if it's not used.
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.
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.
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.
23 comments
[ 3.6 ms ] story [ 53.3 ms ] threadMy solution after years of agony has been to just throw it all out, and use a diff asset packager underneath rails.
Really happy that people are taking this issue on. Wish I had the time to help out.
Edit: changed link to blob version which will not change line numbers on me.
r_str.chars().next() == Some(MAIN_SEPARATOR)
Definitely not the clearest way to do that.
If I change it to just check the first character for the file separator, as I understand FasterPath does, then of course it is faster:
My implementation: [1] https://github.com/ruby/ruby/blob/68ebbbfebe5b666cf76ab41f1e...[1] https://github.com/ruby/ruby/blob/68ebbbfebe5b666cf76ab41f1e...
There are a ton of edge cases in path manipulation code.