5import Data.Array (range)
6import Data.ArrayBuffer.ArrayBuffer (byteLength, empty)
7import Data.ArrayBuffer.Builder (execPut)
8import Data.ArrayBuffer.DataView (whole)
9import Data.ArrayBuffer.Typed as Typed
10import Data.ArrayBuffer.Types (Float32Array)
11import Data.Float32 (fromNumber')
12import Data.Foldable (for_)
13import Effect (Effect, forE)
14import Effect.Console (log)
15import Effect.Unsafe (unsafePerformEffect)
16import Parsing (runParserT)
17import Performance.Minibench (bench, benchWith)
18import Protobuf.Internal.Decode as Decode
19import Protobuf.Internal.Encode as Encode
20import Protobuf.Internal.Runtime (manyLength)
25 bench \_ -> forE 0 10000 (\_ -> pure unit)
28 for_ (range 1 999) $ \_ -> Encode.encodeFloat (fromNumber' 1.0)
29 log "\nfloatArray 10e3"
32 void $ unsafePerformEffect
33 $ runParserT (whole buf10e3) (Decode.decodeFloatArray (byteLength buf10e3))
34 buf10e4 <- empty (4 * 10000)
35 buf10e4Float :: Float32Array <- Typed.whole buf10e4
36 Typed.fill (fromNumber' 1.0) 0 9999 buf10e4Float
37 log "\nfloatArray 10e4"
40 void $ unsafePerformEffect
41 $ runParserT (whole buf10e4) (Decode.decodeFloatArray (byteLength buf10e4))
42 log "\nmanyLength float 10e4"
45 void $ unsafePerformEffect
46 $ runParserT (whole buf10e4) (manyLength Decode.decodeFloat (byteLength buf10e4))
47 buf10e5 <- empty (4 * 100000)
48 buf10e5Float :: Float32Array <- Typed.whole buf10e5
49 Typed.fill (fromNumber' 1.0) 0 99999 buf10e5Float
50 log "\nfloatArray 10e5"
53 void $ unsafePerformEffect
54 $ runParserT (whole buf10e5) (Decode.decodeFloatArray (byteLength buf10e5))
55 log "\nmanyLength float 10e5"
58 void $ unsafePerformEffect
59 $ runParserT (whole buf10e5) (manyLength Decode.decodeFloat (byteLength buf10e5))
60 buf10e6 <- empty (4 * 1000000)
61 buf10e6Float :: Float32Array <- Typed.whole buf10e6
62 Typed.fill (fromNumber' 7.0) 0 1000000 buf10e6Float
63 log "\nfloatArray 1e6"
65 unsafePerformEffect do
66 void $ runParserT (whole buf10e6) (Decode.decodeFloatArray (byteLength buf10e6))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list