Skip to content
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

Merged
merged 4 commits into from Apr 19, 2023
Merged

Conversation

abrisse
Copy link
Member

@abrisse abrisse commented Apr 18, 2023

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

@coveralls
Copy link

coveralls commented Apr 18, 2023

Coverage Status

Coverage: 82.941% (+0.04%) from 82.906% when pulling c9e4542 on feat/optimizations into a73b483 on develop.

# Skip term if `@prefix` is not true in term definition
next unless td.prefix?
next unless td&.prefix?
Copy link
Member

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 😄

Copy link
Member Author

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?

@gkellogg
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@gkellogg gkellogg left a 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.

@abrisse abrisse merged commit 773f93a into develop Apr 19, 2023
20 checks passed
@gkellogg gkellogg deleted the feat/optimizations branch May 2, 2023 19:36
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.

None yet

3 participants