Skip to content

fix #372: add AppendSkip iterator method #373

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

Merged
merged 1 commit into from
Jun 21, 2019

Conversation

ernado
Copy link
Contributor

@ernado ernado commented Jun 7, 2019

This PR adds AppendSkip method that will allow buffer reuse between skips, as described in #372

The following part was removed:

	if len(captured) == 0 {
		copied := make([]byte, len(remaining))
		copy(copied, remaining)
		return copied
	}

Because it is equivalent to append(captured, remaining...).

Also I've removed the unused captureBuffer structure.

Please ping me if you need any adjustments, clarification or additional tests.

@codecov
Copy link

codecov bot commented Jun 7, 2019

Codecov Report

Merging #373 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #373      +/-   ##
=========================================
+ Coverage   81.57%   81.7%   +0.12%     
=========================================
  Files          41      41              
  Lines        5021    5022       +1     
=========================================
+ Hits         4096    4103       +7     
+ Misses        804     798       -6     
  Partials      121     121
Impacted Files Coverage Δ
iter_skip.go 84.88% <100%> (+0.17%) ⬆️
reflect_struct_decoder.go 48.32% <0%> (+0.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0039f4a...459f0e3. Read the comment docs.

@taowen
Copy link
Contributor

taowen commented Jun 10, 2019

SkipAndReturnBytes and AppendSkip, the name should be similiar. Can you come up a better name?

@ernado
Copy link
Contributor Author

ernado commented Jun 10, 2019

Of course, what about SkipAndAppendBytes?

@taowen taowen merged commit 27518f6 into json-iterator:master Jun 21, 2019
zhenzou pushed a commit to zhenzou/jsoniter that referenced this pull request Feb 2, 2022
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.

2 participants