mirror of
https://github.com/weaveworks/scope.git
synced 2026-09-06 10:17:19 +00:00
* New encoding format:
* Msgpack reports between probe<->app (smaller representation, faster to
encode/decode).
* Still use JSON between app<->UI (try to avoid making javascript deal with
mspack).
The app still suports publishing reports in both gob and JSON, not braking
backwards compatibility.
* Use compile-time generated marshallers/unmarshallers for higher performance. In
order to be able to skip code-generation for certain types, I included
https://github.com/2opremio/go-1/tree/master/codec/codecgen instead of
upstream until https://github.com/ugorji/go/pull/139 is merged.
* Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer
for higher performance and reducing garbage collection (no temporary buffers).
codecgen tool
Generate is given a list of *.go files to parse, and an output file (fout),
codecgen will create an output file file.go which
contains codec.Selfer implementations for the named types found
in the files parsed.
Using codecgen is very straightforward.
Download and install the tool
go get -u github.com/ugorji/go/codec/codecgen
Run the tool on your files
The command line format is:
codecgen [options] (-o outfile) (infile ...)
% codecgen -?
Usage of codecgen:
-c="github.com/ugorji/go/codec": codec path
-o="": out file
-r=".*": regex for type name to match
-rt="": tags for go run
-t="": build tag to put in file
-u=false: Use unsafe, e.g. to avoid unnecessary allocation on []byte->string
-x=false: keep temp file
% codecgen -o values_codecgen.go values.go values2.go moretypedefs.go
To disable code generation for specific types, add a // codecgen: skip comment immediately before its definition. For instance:
// codecgen: skip
type struct Foo {
Bar string
}
Please see the blog article for more information on how to use the tool.