Elm Exactly
Results / elm-bytes /

EncodeBytesTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Bytes.Encode.bytes embeds an existing Bytes value in a new encoding.

A 4-byte value is encoded, then re-encoded with `E.bytes`, and the logged width
of the result is 4.

Results

elm-0.19.1

passran in 72 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
EncodeBytesTest: 4

elm-0.19.2

passran in 41 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
EncodeBytesTest: 4

elm-0.19.3

passran in 44 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
EncodeBytesTest: 4

lamdera-1.5.0

passran in 50 ms
Output
EncodeBytesTest: 4

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-bytes/EncodeBytesTest] in its title.

Source

The -- CHECK: lines give the expected output.

module EncodeBytesTest exposing (main)
{-| Bytes.Encode.bytes embeds an existing Bytes value in a new encoding.
A 4-byte value is encoded, then re-encoded with `E.bytes`, and the logged width
of the result is 4.
-}
-- CHECK: EncodeBytesTest: 4
import Bytes exposing (Bytes, Endianness(..))
import Bytes.Encode as E
import Html exposing (text)
main =
let
innerBytes =
E.encode (E.unsignedInt32 BE 0x12345678)
outerBytes =
E.encode (E.bytes innerBytes)
result =
Bytes.width outerBytes
_ =
Debug.log "EncodeBytesTest" result
in
text (String.fromInt result)