Skip to content
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

Safe optimization for COSE (RFC 8152) and WebAuthn #15

Closed
x448 opened this issue Nov 5, 2019 · 2 comments
Closed

Safe optimization for COSE (RFC 8152) and WebAuthn #15

x448 opened this issue Nov 5, 2019 · 2 comments
Labels
enhancement New feature or request performance
Milestone

Comments

@x448
Copy link
Contributor

x448 commented Nov 5, 2019

It would be nice to be able to decode CBOR maps with integer keys to Go struct, and vice versa.

This feature would speed up and simplify using this library for COSE. It would also speed up WebAuthn since that uses COSE.

@fxamacker fxamacker added the enhancement New feature or request label Nov 5, 2019
@fxamacker fxamacker added this to the v1.3.0 milestone Nov 5, 2019
@fxamacker
Copy link
Owner

Thanks. I'll look into it for v1.3.0.

@fxamacker
Copy link
Owner

Decoding COSE to struct is 42.125% faster than decoding to map[int]interface{} and 42.105% less B/op.

Benchmarks of decoding COSE to map[int]interface{} vs. struct:

BenchmarkDecodeCOSE/COSE_to_Go_map[int]interface_{}-2                         	 1000000	      1600 ns/op	     456 B/op	      13 allocs/op
BenchmarkDecodeCOSE/COSE_to_Go_cbor_test.coseKey-2                            	 2000000	       926 ns/op	     264 B/op	      13 allocs/op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

No branches or pull requests

2 participants