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

Replace standard json library by segmentio's library #527

Closed
wants to merge 1 commit into from

Conversation

dcu
Copy link

@dcu dcu commented Oct 28, 2023

The segmentio json library is a drop-in replacement that it's faster than the standard library. In this case it's ~37% faster.

goos: darwin
goarch: arm64
pkg: github.com/aws/aws-lambda-go/lambda
       │ bench.orig.txt │           bench.json.txt            │
       │     sec/op     │   sec/op     vs base                │
JSON-8      7.901µ ± 0%   4.985µ ± 0%  -36.90% (p=0.000 n=40)

       │ bench.orig.txt │             bench.json.txt             │
       │      B/op      │     B/op       vs base                 │
JSON-8     4.353Ki ± 0%   38.273Ki ± 0%  +779.34% (p=0.000 n=40)

       │ bench.orig.txt │       bench.json.txt       │
       │   allocs/op    │ allocs/op   vs base        │
JSON-8       31.00 ± 0%   17.00 ± 0%  -45.16% (n=40)

re #381

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dcu dcu force-pushed the json-library branch 7 times, most recently from 205953d to b7bee7a Compare October 28, 2023 20:52
@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c4e28da) 72.63% compared to head (c58d997) 72.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #527   +/-   ##
=======================================
  Coverage   72.63%   72.63%           
=======================================
  Files          26       26           
  Lines        1407     1407           
=======================================
  Hits         1022     1022           
  Misses        314      314           
  Partials       71       71           
Files Coverage Δ
cfn/response.go 69.44% <ø> (ø)
cfn/wrap.go 66.66% <ø> (ø)
events/attributevalue.go 78.46% <ø> (ø)
events/cloudwatch_logs.go 60.00% <ø> (ø)
events/codebuild.go 40.90% <ø> (ø)
events/duration.go 40.00% <ø> (ø)
events/ecs_container_instance.go 81.25% <ø> (ø)
events/epoch_time.go 72.72% <ø> (ø)
events/kafka.go 81.25% <ø> (ø)
events/lambda_function_urls.go 79.41% <ø> (ø)
... and 5 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The segment json library is a drop-in replacement that it's faster
than the standard library. In this case it's ~37% faster.

goos: darwin
goarch: arm64
pkg: github.com/aws/aws-lambda-go/lambda
       │ bench.orig.txt │           bench.json.txt            │
       │     sec/op     │   sec/op     vs base                │
JSON-8      7.901µ ± 0%   4.985µ ± 0%  -36.90% (p=0.000 n=40)

       │ bench.orig.txt │             bench.json.txt             │
       │      B/op      │     B/op       vs base                 │
JSON-8     4.353Ki ± 0%   38.273Ki ± 0%  +779.34% (p=0.000 n=40)

       │ bench.orig.txt │       bench.json.txt       │
       │   allocs/op    │ allocs/op   vs base        │
JSON-8       31.00 ± 0%   17.00 ± 0%  -45.16% (n=40)

re aws#381
@bmoffatt
Copy link
Collaborator

I'm not comfortable expanding the dependencies of aws-lambda-go beyond that of Go's standard library.

@bmoffatt bmoffatt closed this Oct 30, 2023
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.

3 participants