New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory optimisation & rubocop on tests #59
Conversation
# Skip term if `@prefix` is not true in term definition | ||
next unless td.prefix? | ||
next unless td&.prefix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Learn something new every day 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite practical, isn't it?
There should probably either be a separate rubocop GH Action, or it should be added to .github/workflows/CI.yml. |
let(:reader_count) {doap_count} | ||
end | ||
|
||
describe ".for" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove these tests? are they redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a mistake, thanks for pointing it out. I have rebased the branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, a few comments spread around to consider either for this PR or another.
97fd59c
to
c9e4542
Compare
The PR improves the memory management. On my benchmark (JSON-LD framing) the memory allocation is reduced by 37%.
It contains minor code modifications on tests to fix some rubocop offenses.
Before
allocated memory by gem
83.70 MB json-ld
allocated memory by file
38.59 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/frame.rb
17.20 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/context.rb
15.30 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/flatten.rb
4.22 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/from_rdf.rb
3.48 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/utils.rb
After
allocated memory by gem
52.95 MB json-ld
allocated memory by file
20.53 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/frame.rb
13.39 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/context.rb
6.42 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/flatten.rb
4.22 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/from_rdf.rb
3.48 MB /home/aymeric/dev/gems/json-ld/lib/json/ld/utils.rb