Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bserdar/jsdecodertest
JSON decoder test
https://github.com/bserdar/jsdecodertest
Last synced: about 1 month ago
JSON representation
JSON decoder test
- Host: GitHub
- URL: https://github.com/bserdar/jsdecodertest
- Owner: bserdar
- Created: 2019-06-25T22:29:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-25T22:37:17.000Z (over 5 years ago)
- Last Synced: 2024-06-20T16:52:08.344Z (7 months ago)
- Language: Go
- Size: 31.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Small test to see if using a literal buffer for keys in JSON decoder
improves memory usage. It does.This test builds a large JSON string, decodes it into an interface{},
runs GC and prints memory stats.To use standard decoder:
``` go
import (
//"github.com/bserdar/jsdecodertest/json"
"encoding/json"
)```
To use the modified decoder:
``` go
import (
"github.com/bserdar/jsdecodertest/json"
//"encoding/json"
)```
The jsdecodertest/json package is a copy of the standard library
encoding/json, with a literal map in the decoder
state. decoderState.objectInterface uses the literal map to store
field keys in a map.Using standard library:
Alloc:401839488Use modified decoder:
Alloc:353839856This simple test only works when decoding into an interface{}.