Opportunity to improve the json decoding performance #2238
Labels
e: performance
Improvements or additions to performance
p: dio
Targeting `dio` package
s: best practise
It's the best way to do something so far
s: feature
This issue indicates a feature request
Request Statement
Hi there!
I experimented a bit with the hidden
_JsonUtf8Decoder
which is created when fusing theutf8
decoder with thejson
decoder.This significantly improves the decoding performance.
I created a benchmark here.
It shows an improvement of around ~10x in AOT mode on sufficiently large json responses. (around 64 KiB).
Here's the improved Transformer:
Note: you need a recent version of Dart to see these performance improvements.
This would be a nice improvement for Dio. Who doesn't like free improved performance?
A caveat is, that this is not compatible with the default
BackgroundTransformer
, as the callback in this transformer takes a String, not a Uint8List.To get the benefits there, a change in the API would be required (or we could add a new
BackgroundTransformer
class).Would you be open to a PR that integrates these changes in the existing SyncTransformer?
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: