jwt icon indicating copy to clipboard operation
jwt copied to clipboard

Replace encoding/json with jsoniter

Open lggomez opened this issue 4 years ago • 3 comments

Migrated from https://github.com/dgrijalva/jwt-go/issues/358:

fredbi commented on Sep 3, 2019

github.com/json-iterator/go is currently one of the fastest libs available to process json. Besides, it is a simple drop-in replacement for the standard lib, without much code change.

I am proposing PR #357 to validate the concept and expose benchmarks on signing and parsing methods.

NOTE: due to some changes in the order of marshalled claims, testable examples verifying the value of the signed string have been adapted to check for decoded claims instead.

lggomez avatar Aug 03 '21 13:08 lggomez

fredbi commented on Sep 6, 2019

Attention: notice that this breaks compatibility with older golang versions. I don't think that keeping a compatibility promise back to versions older than 1.7 brings much value. This PR imposes golang 1.7+.

lggomez avatar Aug 03 '21 13:08 lggomez

Thanks for all the effort @lggomez :)

I am inclined to close this as "won't fix". I would argue that keeping this library with 0 dependencies is one of the best, not the best feature of this library. Especially looking at the other libraries that tend to have quite a few deps.

oxisto avatar Aug 03 '21 13:08 oxisto

Thanks for all the effort @lggomez :)

Thanks! trying to get rid of some management debt in here since I'm not very active on the repo due to schedule

I am inclined to close this as "won't fix". I would argue that keeping this library with 0 dependencies is one of the best, not the best feature of this library. Especially looking at the other libraries that tend to have quite a few deps.

I agree that possibly the best feature is the premise of strict stdlib dependency but I still found this issue interesting to discuss. The json marshaler overhead is almost neglegible on signing time since all of that CPU load goes to crypto but it'd be interesting to see how the parser performs (I see there aren't any benchmarks on that part yet)

lggomez avatar Aug 03 '21 13:08 lggomez