Skip to content

Commit 6f3c9f3

Browse files
committed
Use Text instead of ShortText. Release 0.3.0.0.
1 parent 81404d0 commit 6f3c9f3

File tree

7 files changed

+304
-203
lines changed

7 files changed

+304
-203
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Revision history for json-syntax
22

3+
## 0.3.0.0 -- 2025-07-14
4+
5+
* Switch from ShortText to Text. In many cases, this makes it possible for the
6+
resulting Value to share the input byte array instead of allocating additional
7+
memory.
8+
* Get rid of word-compat. Require new GHC instead.
9+
* Optimize decoding. Time for `json/twitter/100/decode` drops from 190us to 150us.
10+
311
## 0.2.7.2 -- 2024-02-07
412

513
* Fix build with GHC 9.8.

bench/Main.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE BangPatterns #-}
12
{-# LANGUAGE ScopedTypeVariables #-}
23
{-# LANGUAGE TypeApplications #-}
34

@@ -6,6 +7,7 @@ import Gauge.Main (bench, bgroup, defaultMain, whnf)
67
import Metrics1024 (encodedMetrics1024)
78
import Twitter100 (byteStringTwitter100, encodedTwitter100)
89
import Url100 (byteStringUrl100, encodedUrl100)
10+
import Data.Bytes (Bytes)
911

1012
import qualified Data.Aeson as Aeson
1113
import qualified Data.ByteString.Lazy as LBS
@@ -29,6 +31,7 @@ main = do
2931
aesonValueTwitter100 <- case Aeson.decodeStrict' byteStringTwitter100 of
3032
Nothing -> fail "aeson failed to decode twitter-100"
3133
Just (v :: Aeson.Value) -> pure v
34+
let !encodedCompactTwitter100 = Chunks.concat (BLDR.run 128 (J.encode valueTwitter100)) :: Bytes
3235
defaultMain
3336
[ bgroup
3437
"json"
@@ -50,6 +53,14 @@ main = do
5053
valueTwitter100
5154
]
5255
]
56+
, bgroup
57+
"twitter-compact"
58+
[ bgroup
59+
"100"
60+
[ bench "decode" $
61+
whnf J.decode encodedCompactTwitter100
62+
]
63+
]
5364
, bgroup
5465
"url"
5566
[ bgroup

json-syntax.cabal

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,18 @@ library
4545
, array-builder >=0.1 && <0.2
4646
, array-chunks >=0.1.3 && <0.2
4747
, base >=4.15 && <5
48-
, bytebuild >=0.3.10 && <0.4
48+
, bytebuild >=0.3.12 && <0.4
4949
, byteslice >=0.2.9 && <0.3
50-
, bytesmith >=0.3.8 && <0.4
50+
, bytesmith >=0.3.13 && <0.4
5151
, bytestring >=0.10.8 && <0.12
5252
, contiguous >=0.6 && <0.7
5353
, natural-arithmetic >=0.1.2 && <0.3
5454
, primitive >=0.7 && <0.10
5555
, run-st >=0.1.1 && <0.2
5656
, scientific-notation >=0.1.6 && <0.2
57-
, text >=2.0.2 && <2.2
57+
, text >=2.1.2 && <2.2
5858
, text-short >=0.1.3 && <0.2
5959
, transformers >=0.5.6 && <0.7
60-
, word-compat >=0.0.6 && <0.1
6160
, zigzag >=0.0.1 && <0.1
6261

6362
hs-source-dirs: src

0 commit comments

Comments
 (0)