-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Json type optimization #2006
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
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3161b7a
tests: Add missing tests
jachym-tousek-keboola 5544ef4
feat: Optimize json type
jachym-tousek-keboola b8d97be
feat: Improve url.ParseQuery
jachym-tousek-keboola f7c83c5
fix: Improve json detection
jachym-tousek-keboola d1ac163
tests: Add tests for form data
jachym-tousek-keboola 20c8459
fix: Accidental caching in benchmarks
jachym-tousek-keboola d584e34
fix: Simplify code
jachym-tousek-keboola 13b98e4
fix: Simplify jsonPathCSVValue
jachym-tousek-keboola 9de164c
fix: Cache fastjson.Value
jachym-tousek-keboola 3213720
fix: int conversion
jachym-tousek-keboola 8b04c93
docs: Add comments
jachym-tousek-keboola 8604191
fix: Simplify DefaultValue handling
jachym-tousek-keboola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,11 @@ func BenchmarkColumn_Path(b *testing.B) { | |
|
|
||
| body := `{"key1":[{"key2":"val2"},{"key3":"val3"}]}` | ||
| header := http.Header{"Content-Type": []string{"application/json"}} | ||
| reqCtx := recordctx.FromHTTP(time.Now(), &http.Request{Header: header, Body: io.NopCloser(strings.NewReader(body))}) | ||
| renderer := column.NewRenderer() | ||
|
|
||
| for i := 0; i < b.N; i++ { | ||
| // reqCtx needs to be created separately for each request, otherwise the parsed json is cached | ||
| reqCtx := recordctx.FromHTTP(time.Now(), &http.Request{Header: header, Body: io.NopCloser(strings.NewReader(body))}) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| val, err := renderer.CSVValue(c, reqCtx) | ||
| assert.NoError(b, err) | ||
| assert.Equal(b, `"val3"`, val) | ||
|
|
@@ -38,10 +39,10 @@ func BenchmarkColumn_Template_Jsonnet(b *testing.B) { | |
|
|
||
| body := `{"key1":[{"key2":"val2"},{"key3":"val3"}]}` | ||
| header := http.Header{"Content-Type": []string{"application/json"}} | ||
| reqCtx := recordctx.FromHTTP(time.Now(), &http.Request{Header: header, Body: io.NopCloser(strings.NewReader(body))}) | ||
| renderer := column.NewRenderer() | ||
|
|
||
| for i := 0; i < b.N; i++ { | ||
| reqCtx := recordctx.FromHTTP(time.Now(), &http.Request{Header: header, Body: io.NopCloser(strings.NewReader(body))}) | ||
| val, err := renderer.CSVValue(c, reqCtx) | ||
| assert.NoError(b, err) | ||
| assert.Equal(b, `"val3"`, val) | ||
|
|
@@ -51,10 +52,10 @@ func BenchmarkColumn_Template_Jsonnet(b *testing.B) { | |
| func BenchmarkColumn_UUID(b *testing.B) { | ||
| c := column.UUID{} | ||
|
|
||
| reqCtx := recordctx.FromHTTP(time.Now(), &http.Request{}) | ||
| renderer := column.NewRenderer() | ||
|
|
||
| for i := 0; i < b.N; i++ { | ||
| reqCtx := recordctx.FromHTTP(time.Now(), &http.Request{}) | ||
| val, err := renderer.CSVValue(c, reqCtx) | ||
| assert.NoError(b, err) | ||
| assert.Len(b, val, 36) | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.