You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My 250 pages site has a sidebar which links to every/most pages. I was tired to building the site taking so long, so after a bit of profiling, I noticed that #relative_url isn't memoized. So every link needs to rebuild the same relative urls.
Memoizing with the following in my config/initializers.rb made my build time go from 10s to 5s.
module MemoizeRelativeUrl
def relative_url
@relative_url ||= super
end
end
Bridgetown::Resource::Base.prepend(MemoizeRelativeUrl)
I don't know if a relative_url is meant to change over the course of a build, but if it isn't, this is a massive usability improvement for me.
I don't know if the change should be on Bridgetown::Resource::Base or Bridgetown::Resource::Destination or somewhere else, but I think there should definitely be memoization somewhere.
The text was updated successfully, but these errors were encountered:
My 250 pages site has a sidebar which links to every/most pages. I was tired to building the site taking so long, so after a bit of profiling, I noticed that
#relative_url
isn't memoized. So every link needs to rebuild the same relative urls.Memoizing with the following in my
config/initializers.rb
made my build time go from 10s to 5s.I don't know if a relative_url is meant to change over the course of a build, but if it isn't, this is a massive usability improvement for me.
I don't know if the change should be on
Bridgetown::Resource::Base
orBridgetown::Resource::Destination
or somewhere else, but I think there should definitely be memoization somewhere.The text was updated successfully, but these errors were encountered: