Skip to content

parser_json: speed up parsing when no value conversion is configured - #5579

Merged
kenhys merged 2 commits into
fluent:masterfrom
Watson1978:parser-json-skip-convert-values
Nov 2, 2026
Merged

kenhys merged 2 commits into
fluent:masterfrom
Watson1978:parser-json-skip-convert-values

Conversation

@Watson1978

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:
Since #4474, JSONParser#parse calls convert_values for every record through parse_one_record. convert_values returns a new [time, record] array even when types, null_value_pattern and null_empty_string are not set. This PR checks @execute_convert_values in parse again, as before #4474, and removes parse_one_record. I found no plugin on RubyGems that calls or overrides parse_one_record, or that overrides convert_values in a JSONParser subclass.

rake benchmark:run:in_tail (1 GB of JSON lines), median in shuffled order:

Platform Output master This PR Paired diff
Linux file 2.449 s 2.403 s -1.8%
Linux null 1.099 s 1.065 s -2.3%
Windows file 5.671 s 5.499 s -1.9%
Windows null 2.877 s 2.741 s -4.6%

Docs Changes:
None.

Release Note:
parser_json: Improve parsing performance when no value conversion is configured.

🤖 Generated with Claude Code

Watson1978 and others added 2 commits October 30, 2026 18:26
Since fluent#4474, parse calls convert_values for every record through
parse_one_record. convert_values returns a new [time, record] array
even when types, null_value_pattern and null_empty_string are not set.

Check @execute_convert_values in parse again, as before fluent#4474, and
remove parse_one_record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
The assertions were only in the block, so the test passed even when
parse yielded nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Watson1978 requested a review from kenhys October 30, 2026 23:28
@kenhys
kenhys merged commit 9283570 into fluent:master Nov 2, 2026
20 checks passed
@Watson1978 Watson1978 added this to the v1.21.0 milestone Nov 2, 2026
@Watson1978
Watson1978 deleted the parser-json-skip-convert-values branch November 2, 2026 01:32
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