Aliaksandr Valialkin
Aliaksandr Valialkin
It is hard to determine the root cause of the issue without the contents of `loadTestJSON` and `getConsumerMappings` function bodies. Try moving `loadTestJSON` call outside the loop.
You need to use [strconv.ParseInt](https://golang.org/pkg/strconv/#ParseInt) instead of `binary.LittleEndian.Uint32`.
> I expect this change to reduce memory consumption by about 30% for large JSON values and avoid copying. Uh I didn't notice this line. I thought the patch is...
It is possible to parse JSON by `fastjson` into a `map[string]interface`, but it has little sense, since: - it will allocate a lot in general case, so the performance will...
`MarshalTo` must append data to the passed in slice. Just `len(out) = 0` in the code above, so its' length must be extended before comparison. Try running the following code:...
See https://blog.golang.org/go-slices-usage-and-internals to understand better how slices in Go work
The proper use case for `MarshalTo` is: ```go // The out slice is defined once and re-used multiple times // inside the loop for marshaling different values. var out []byte...
Agreed on all the remarks. > Commit c188f76 might cause memory leaks. For example, when a very large array is reused as an object, the array is kept in memory....
This sounds interesting... I need some time to evaluate the proposed approach in the PR.
@JeanMertz , it looks like you need [Value.GetStringBytes](https://godoc.org/github.com/valyala/fastjson#Value.GetStringBytes) : ```go var p fastjson.Parser v, err := p.ParseBytes(data) if err != nil { log.Fatal(err) } sb1 := v.GetStringBytes("foo", "bar", "baz") sb2...