Skip to content

Autoload RSS::Maker - #74

Open
czj wants to merge 1 commit into
ruby:masterfrom
czj:autoload-maker
Open

czj wants to merge 1 commit into
ruby:masterfrom
czj:autoload-maker

Conversation

@czj

@czj czj commented Oct 22, 2026

Copy link
Copy Markdown

require "rss" loads the feed generators along with the parsers, so an app that only parses feeds pays for rss/maker too: about 97k allocated objects, 24k retained objects, 5.3 MB of RSS and 33 ms per process on Ruby 4.0.7, on top of the 127k objects and 11 MB of the parsers.

This autoloads RSS::Maker instead of requiring it. RSS::Maker.make and #to_feed load it on first use, and every other file require "rss" loaded is still loaded.

On our app, a Rails e-commerce site that only reads feeds to display them, this is 5 MB less in every process.

test/test-autoload.rb checks in a subprocess that require "rss" doesn't load rss/maker and that referencing RSS::Maker does: it fails without the change. The suite passes, 322 tests.


🤖 Generated with Claude Code, but prompted, read, and verified by @czj, a caring human :)

require "rss" loaded the feed generators along with the parsers. Apps
that only parse feeds now skip rss/maker: about 97k allocated objects,
24k retained objects and 5 MB RSS less per process.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant