nuclearg opened a new pull request, #375: URL: https://github.com/apache/dubbo-go-hessian2/pull/375
<!-- Thanks for sending a pull request! --> **What this PR does**: decode.go 里面的 Decode() 每次在解析map或list时都会触发一次对 d.refHolders 的轮询 notify(),在解析复杂对象时(我的场景需要处理约10M的数据),这个 Decode() 会被疯狂递归调用,无数次对这个 d.refHolders() 进行无用的 notify(),产生严重的性能问题 我的机器是 MacBook Pro M3Pro 36G,在我本机上,处理10M的数据时,rt将达到5秒。此性能不可接受。 本次改动对 Decode() 的递归次数进行计数,只在最外层的 Decode() 时进行 notify() 操作。 可以通过MR中的 decode_largedata_test.go 验证。此测试用例随机生成一个巨大的map/list相互嵌套的结构并执行序列化/反序列化操作。未引入我的修改时,反序列化的rt远高于序列化(秒级)。引入此修改后序列化与反序列化rt持平(毫秒级) **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_* --> Fixes # **Special notes for your reviewer**: **Does this PR introduce a user-facing change?**: <!-- If no, just write "NONE" in the release-note block below. If yes, a release note is required: Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". --> ```release-note NONE ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
