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

Proposing a new implementation for Range encoding #171

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Afoucaul
Copy link

@Afoucaul Afoucaul commented Aug 8, 2018

The previous implementation of Encoder for Range was putting all the possible elements into a list, so 1..10 resulted in [1,2,3,4,5,6,7,8,9,10], and likewise, 1..999999999 would produce a huge message (which would actually freeze your computer).

The implementation I'm proposing simply treats a range as its underlying map, with a :first and a :last fields.

Armand added 3 commits August 8, 2018 14:18
The previous implementation was encoding a range as a list of possible
values. This is not a viable approach, as it can possibly lead to huge
messages.
The new implementation treats a range as it is: a map, with a :first and
a :last fields. Thus, the resulting bitstring of Poison.encode(a..b) is
the same as Poison.encode(%{first: a, last: b}).
@coveralls
Copy link

coveralls commented Aug 8, 2018

Pull Request Test Coverage Report for Build 240

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 89.474%

Totals Coverage Status
Change from base Build 236: 0.05%
Covered Lines: 187
Relevant Lines: 209

💛 - Coveralls

@devinus devinus force-pushed the master branch 22 times, most recently from 29a475d to e0a080a Compare July 23, 2021 07:52
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

2 participants