Aliaksandr Valialkin
Aliaksandr Valialkin
Unfortunately currently `fastjson` doesn't provide fast access to the underlying byte slice for JSON values. There is [Value.String](https://godoc.org/github.com/valyala/fastjson#Value.String), but it is for debugging purposes only. Let's keep this issue open....
@JeanMertz , I added [Value.MarshalTo](https://godoc.org/github.com/valyala/fastjson#Value.MarshalTo) for fast json serialization into byte slice. See [the example](https://godoc.org/github.com/valyala/fastjson#example-Value-MarshalTo) on how to use it.
FYI, now it's possible to parse, modify and marshal modified json: ```go // Parse the json v, err := fastjson.Parse(`{"foo":"bar", "baz": 123}`) if err != nil { log.Fatal(err) } //...
This optimization shouldn't give significant win: ``` $ GOMAXPROCS=1 go test github.com/valyala/fastjson -run=111 -bench=Parse$/large/fastjson$ -benchtime=10s -cpuprofile=cpu.pprof $ go tool pprof cpu.pprof (pprof) list Parse$ ROUTINE ======================== github.com/valyala/fastjson.(*Parser).Parse in /home/valyala/go/src/github.com/valyala/fastjson/parser.go 10ms...
There are two options exist: 1) Manually convert int/bool/float to string before passing to template. 2) Implement [TagFunc](https://godoc.org/github.com/valyala/fasttemplate#TagFunc) for int/bool/float. Another option is to use [quicktemplate](https://github.com/valyala/quicktemplate) instead. It supports int...
The performance difference looks unexpected. > Is that the cost of adding CRC (in terms of speed?) Probably this is related to different API functions used for stream compression: *...
I think I found the main issue that explains performance difference and compressed size difference: the [readahead](https://github.com/klauspost/readahead) implements [WriteTo](https://github.com/klauspost/readahead/blob/master/reader.go#L298) method, which is short-circuited inside `io.Copy`, so it tends to pass...
Probably `ZSTD_CStreamInSize` should return bigger value, since it results in better compression speed and ratio? cc'ing @Cyan4973 for the input.
Yann, thanks for the explanation! I'll add the ability to configure internal buffer size for streaming compression by providing new API in `valyala/gozstd` for this use case. @klauspost , could...
It looks like Windows support is broken, since nobody used it since [the addition](https://github.com/valyala/gozstd/commit/46bf807f36902861e68a44a8c94ad4d81769ea79) :( @zhuyie , could you look into Windows support for `github.com/valyala/gozstd`? In the mean time try...