-
Notifications
You must be signed in to change notification settings - Fork 296
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
Allow disabling code-generation for individual types #139
Conversation
* 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 marshaller/unmarshaller for higher performance. In order to be able to skip code-generation for certain types, use https://github.com/2opremio/go-1/tree/master/codec/codecgen instead of upstream until ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
ffjson uses comments to control behaviour. go-codec doesn't as a matter of design principle. For that reason, using comments will have a very high barrier for consideration/acceptance. I would be willing to do a not-match flag i.e. only include types which "match" the "match" regex and "do not match" the "not-match" regex. I understand the limitations of the golang regex package: however, we will live with it, as that is not the core of the go-codec solution. Your options are:
Both of these are workable solutions. They are not ideal, but I think (from the POV of the design of go-codec) that using comments is a non-starter. Using comments here will be a one-off solution that feels foreign to the solution - like it was tacked on. |
I find the Closing in favor of #140 |
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
* 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 ugorji/go#139 is merged. * Encode/decode intermediate types using github.com/ugorji/go/codec.Selfer for higher performance and reducing garbage collection (no temporary buffers).
This is inspired by
// ffjson: skip
There are situations in which the user needs/wants to provide custom
Selfer
s for some of the types declared in a file while still being able to automatically generateSelfer
s for the the rest of the types in that file.For instance see weaveworks/scope@23ddc1b
I couldn't find an acceptable way to do this with the existing implementation:
-r
parameter ofcodecgen
is not good enough for excluding types. Regexps are not well suited for negative matching of words. On top of that, Go's regexp implementation intentionally doesn't support lookaheads to comply with its O(n) matching promises, which makes it particularly hard (see http://stackoverflow.com/questions/2078915/a-regular-expression-to-exclude-a-word-string and https://groups.google.com/d/msg/golang-nuts/7qgSDWPIh_E/OHTAm4wRZL0J )