Repository navigation
Conversation
pocke
force-pushed
the
Use_array_instead_of_linked_list_for_RBS__Location_s_child
branch
from
April 5, 2024 02:18
f00b016 to
18602a7
Compare
pocke
marked this pull request as ready for review
April 8, 2024 07:22
pocke
deleted the
Use_array_instead_of_linked_list_for_RBS__Location_s_child
branch
April 15, 2024 04:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reduces memory usage by replacing the linked list with an array for
RBS::Location.RBS::Locationhas child locations. They are implemented as two linked lists, but this is not memory efficient.Therefore this PR replaces the linked lists with an array.
This PR is the first part of memory usage improvement for
RBS::Location. I'll try reducing memory with another approach. See this document for more information. https://hackmd.io/QNkMU6roTqSn_iXb2ENhsAData structure
This is the previous data structure.
Comments are byte sizes (on my 64bits local machine).
By this change, these structs are changed to the following:
The byte size is changed like following:
rbs_locdoes not have children:rbs_lochas children:Benchmarking
Memory Usage
With
bundle exec ruby benchmark/memory_new_env.rbandbenchmark/memory_new_rails_env.rbbefore
after
The retained memory is reduced 3% (349kb) on the core env and 4% (2MB) on the Rails env.
Execution time
With
bundle exec ruby benchmark/benchmark_new_env.rb.before
after
It is 1.04x faster on the core env and 1.05x faster on the Rails env.