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

Provide more deccode context to the hooks #123

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@bep
Copy link

bep commented May 17, 2018

When decoding into a generic map (or a struct that contains a generic map) knowing the source's type information isn't enough information to do type conversions in a hook.

Adding the name improves this, as it makes it possible to create a "type converter registry".

Adding a new func type for this is unfortunate, but that is to preserver backwards compability.

benchmark              old ns/op     new ns/op     delta
Benchmark_Decode-4     6991          7183          +2.75%

benchmark              old allocs     new allocs     delta
Benchmark_Decode-4     51             54             +5.88%

benchmark              old bytes     new bytes     delta
Benchmark_Decode-4     1992          2088          +4.82%

Fixes #122

Provide more deccode context to the hooks
When decoding into a generic map (or a struct that contains a generic map) knowing the source's type information isn't enough information to do type conversions in a hook.

Adding the `name` improves this, as it makes it possible to create a "type converter registry".

Adding a new func type for this is unfortunate, but that is to preserver backwards compability.

```bash
benchmark              old ns/op     new ns/op     delta
Benchmark_Decode-4     6991          7183          +2.75%

benchmark              old allocs     new allocs     delta
Benchmark_Decode-4     51             54             +5.88%

benchmark              old bytes     new bytes     delta
Benchmark_Decode-4     1992          2088          +4.82%
```

Fixes #122
@bep

This comment has been minimized.

Copy link

bep commented Nov 14, 2018

I assume this library isn't actively maintained anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment