-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Data.Aeson.Decoding.Text, decodeStrictText :: Text -> ...
We avoid intermediate ByteString copy by not doing `decode . TE.encodeUtf8`, but instead working on `Text` value directly. As we know that the stream is valid Unicode (UTF8 or UTF16), we can also take some shortcuts. One gotcha is that internal Text values (in Keys or Value Strings) most likely retain the original input `Text` value (its Array). It shouldn't be an issue if the Value is actually decoded so these `Text` values disapper, but if not (e.g. `Object` keys survive) then users might want to use `Data.Text.copy`. With GHC-9.6.2 (text-2.0.2; UTF-8) the speedup is not huge, but noticeable anyway: aeson/strict: OK (0.26s) 462 μs ± 23 μs aeson/text: OK (0.22s) 399 μs ± 25 μs aeson/text-via-bs: OK (0.14s) 473 μs ± 45 μs With GHC-8.6.5 (text-1.2.3.0; UTF-16) the speedup is relatively more: aeson/strict: OK (0.22s) 819 μs ± 74 μs aeson/text: OK (0.17s) 593 μs ± 46 μs aeson/text-via-bs: OK (0.23s) 875 μs ± 62 μs
- Loading branch information
Showing
229 changed files
with
401,634 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.