perf: eliminate redundant JSON marshal/unmarshal in convertJSONToParquet - #26
Merged
Merged
Conversation
…uet (#16) - Add mapToDatabaseActivityEvent and type-safe helpers (getString, getInt64, getStringSlice) to directly convert generic maps to DatabaseActivityEvent - Eliminate per-event json.Marshal and json.Unmarshal loop in convertJSONToParquet - Pre-allocate output buffer capacity (buf.Grow) to minimize heap allocations - Add unit tests verifying all 21 struct field conversions and type coercions - Add BenchmarkConvertJSONToParquet and BenchmarkMapToDatabaseActivityEvent (showing 180ns/op and 1 alloc/op) - Increase test statement coverage to 84.7%
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.
Fixes #16
Summary of Changes
json.Marshal+json.Unmarshalloop inconvertJSONToParquetwith a fast, zero-serde helper functionmapToDatabaseActivityEvent.buf.Grow(len(decompressedJSON) / 2)to minimize buffer resizing during Parquet compression.BenchmarkMapToDatabaseActivityEvent: Executes in ~180 ns/op with 1 allocation (32 B/op).BenchmarkConvertJSONToParquet: Continuous performance tracking for Parquet generation on DAS event fixtures.convert_test.goverifying all 21 struct fields, string/int64 conversions, and slice handling.