async-stripe icon indicating copy to clipboard operation
async-stripe copied to clipboard

perf: Remove unnecessary allocation and construction of a HashMap in Signature::parse

Open mennovf opened this issue 1 year ago • 4 comments

Summary

I noticed Signature::parse constructs a temporary HashMap for some reason. I removed this allocation and weird construction to speed up the parsing. I see no need for the wasteful temporary.

Checklist

  • [x] ran cargo make fmt
  • [x] using conventional commits to hightlight user-facing fixes and features

mennovf avatar Aug 28 '24 12:08 mennovf

Thanks for the pr, this looks good to me! Is pretty similar to the implementation in the next branch, but good to get in sooner.

Only semantic difference looks like missing = in signature chunk is ignored here, vs errored in next branch implementation.

mzeitlin11 avatar Sep 01 '24 19:09 mzeitlin11

I was unaware of the ongoing effort on the next branch when I made this pull request. I could copy over its code into this pull request or just close it and wait for next.

mennovf avatar Sep 01 '24 21:09 mennovf

I am ok with backporting it, running CI

arlyon avatar Sep 03 '24 09:09 arlyon

Hello, @mennovf, I have recently merged some changes to bump msrv and fix the CI issues. Please rebase when you have the chance :)

arlyon avatar Sep 24 '24 19:09 arlyon

Sorry about this PR, it fell off my queue. Next has landed (well, well overdue) and so this is unneeded.

arlyon avatar Sep 16 '25 20:09 arlyon