-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reformatted. Added workflows. Updated package metadata.
- Loading branch information
1 parent
0a79b2d
commit 277d03b
Showing
26 changed files
with
2,408 additions
and
1,926 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@byteverse/l3c |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: build | ||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
call-workflow: | ||
uses: byteverse/.github/.github/workflows/build.yaml@main | ||
secrets: inherit | ||
with: | ||
release: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
call-workflow: | ||
uses: byteverse/.github/.github/workflows/build.yaml@main | ||
secrets: inherit | ||
with: | ||
release: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,96 @@ | ||
{-# language LambdaCase #-} | ||
{-# language OverloadedStrings #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
import Data.Primitive (ByteArray) | ||
import Data.Word (Word64) | ||
import Gauge (bgroup,bench,whnf) | ||
import Gauge (bench, bgroup, whnf) | ||
import Gauge.Main (defaultMain) | ||
|
||
import qualified Arithmetic.Nat as Nat | ||
import qualified Data.Bytes.Builder as B | ||
import qualified Data.Bytes.Builder.Bounded as U | ||
|
||
import qualified Cell | ||
import qualified SimpleCsv | ||
import qualified HexWord64 | ||
import qualified SimpleCsv | ||
import qualified Word16Tree | ||
|
||
main :: IO () | ||
main = defaultMain | ||
[ bgroup "w64" | ||
[ bgroup "hex" | ||
[ bench "library" (whnf encodeHexWord64s w64s) | ||
, bench "loop" (whnf encodeHexWord64sLoop w64s) | ||
] | ||
main = | ||
defaultMain | ||
[ bgroup | ||
"w64" | ||
[ bgroup | ||
"hex" | ||
[ bench "library" (whnf encodeHexWord64s w64s) | ||
, bench "loop" (whnf encodeHexWord64sLoop w64s) | ||
] | ||
] | ||
, bgroup | ||
"unbounded" | ||
[ bench "csv-no-escape" $ | ||
whnf | ||
(\x -> B.run 4080 (SimpleCsv.encodeRows x)) | ||
Cell.cells | ||
, bench "word-16-tree-small" $ | ||
whnf | ||
(\x -> B.run 4080 (Word16Tree.encode x)) | ||
Word16Tree.exampleSmall | ||
, bench "word-16-tree-2000" $ | ||
whnf | ||
(\x -> B.run ((4096 * 16) - 16) (Word16Tree.encode x)) | ||
Word16Tree.example2000 | ||
, bench "word-16-tree-9000" $ | ||
whnf | ||
(\x -> B.run ((4096 * 64) - 16) (Word16Tree.encode x)) | ||
Word16Tree.example9000 | ||
] | ||
] | ||
, bgroup "unbounded" | ||
[ bench "csv-no-escape" $ whnf | ||
(\x -> B.run 4080 (SimpleCsv.encodeRows x)) | ||
Cell.cells | ||
, bench "word-16-tree-small" $ whnf | ||
(\x -> B.run 4080 (Word16Tree.encode x)) | ||
Word16Tree.exampleSmall | ||
, bench "word-16-tree-2000" $ whnf | ||
(\x -> B.run ((4096 * 16) - 16) (Word16Tree.encode x)) | ||
Word16Tree.example2000 | ||
, bench "word-16-tree-9000" $ whnf | ||
(\x -> B.run ((4096 * 64) - 16) (Word16Tree.encode x)) | ||
Word16Tree.example9000 | ||
] | ||
] | ||
|
||
w64s :: Word64s | ||
w64s = Word64s | ||
0xde2b8a480cf77113 | ||
0x48f1668ca2a68b45 | ||
0xd262fbaa0b2f473c | ||
0xbab20547f4919d9f | ||
0xb7ec16121704db43 | ||
0x9c259f5bfa90e1eb | ||
0xd451eca11d9873ad | ||
0xbd927e8d4c879d02 | ||
w64s = | ||
Word64s | ||
0xde2b8a480cf77113 | ||
0x48f1668ca2a68b45 | ||
0xd262fbaa0b2f473c | ||
0xbab20547f4919d9f | ||
0xb7ec16121704db43 | ||
0x9c259f5bfa90e1eb | ||
0xd451eca11d9873ad | ||
0xbd927e8d4c879d02 | ||
|
||
data Word64s = Word64s | ||
!Word64 !Word64 !Word64 !Word64 | ||
!Word64 !Word64 !Word64 !Word64 | ||
data Word64s | ||
= Word64s | ||
!Word64 | ||
!Word64 | ||
!Word64 | ||
!Word64 | ||
!Word64 | ||
!Word64 | ||
!Word64 | ||
!Word64 | ||
|
||
encodeHexWord64s :: Word64s -> ByteArray | ||
{-# noinline encodeHexWord64s #-} | ||
encodeHexWord64s (Word64s a b c d e f g h) = U.run Nat.constant $ | ||
U.word64PaddedUpperHex a `U.append` | ||
U.word64PaddedUpperHex b `U.append` | ||
U.word64PaddedUpperHex c `U.append` | ||
U.word64PaddedUpperHex d `U.append` | ||
U.word64PaddedUpperHex e `U.append` | ||
U.word64PaddedUpperHex f `U.append` | ||
U.word64PaddedUpperHex g `U.append` | ||
U.word64PaddedUpperHex h | ||
{-# NOINLINE encodeHexWord64s #-} | ||
encodeHexWord64s (Word64s a b c d e f g h) = | ||
U.run Nat.constant $ | ||
U.word64PaddedUpperHex a | ||
`U.append` U.word64PaddedUpperHex b | ||
`U.append` U.word64PaddedUpperHex c | ||
`U.append` U.word64PaddedUpperHex d | ||
`U.append` U.word64PaddedUpperHex e | ||
`U.append` U.word64PaddedUpperHex f | ||
`U.append` U.word64PaddedUpperHex g | ||
`U.append` U.word64PaddedUpperHex h | ||
|
||
encodeHexWord64sLoop :: Word64s -> ByteArray | ||
{-# noinline encodeHexWord64sLoop #-} | ||
encodeHexWord64sLoop (Word64s a b c d e f g h) = U.run Nat.constant $ | ||
HexWord64.word64PaddedUpperHex a `U.append` | ||
HexWord64.word64PaddedUpperHex b `U.append` | ||
HexWord64.word64PaddedUpperHex c `U.append` | ||
HexWord64.word64PaddedUpperHex d `U.append` | ||
HexWord64.word64PaddedUpperHex e `U.append` | ||
HexWord64.word64PaddedUpperHex f `U.append` | ||
HexWord64.word64PaddedUpperHex g `U.append` | ||
HexWord64.word64PaddedUpperHex h | ||
|
||
{-# NOINLINE encodeHexWord64sLoop #-} | ||
encodeHexWord64sLoop (Word64s a b c d e f g h) = | ||
U.run Nat.constant $ | ||
HexWord64.word64PaddedUpperHex a | ||
`U.append` HexWord64.word64PaddedUpperHex b | ||
`U.append` HexWord64.word64PaddedUpperHex c | ||
`U.append` HexWord64.word64PaddedUpperHex d | ||
`U.append` HexWord64.word64PaddedUpperHex e | ||
`U.append` HexWord64.word64PaddedUpperHex f | ||
`U.append` HexWord64.word64PaddedUpperHex g | ||
`U.append` HexWord64.word64PaddedUpperHex h |
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.