Elm Exactly
Results / elm-core /

StringRopeContentTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks that a 140000-character string built by 1400 successive appends has the right length and intact content at both ends.

Each append adds `"abcdefghij"` repeated 10 times to the end of the
accumulator, so the first and the last ten characters must both be
`"abcdefghij"`.

Results

elm-0.19.1

passran in 71 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
rope_len: 140000
rope_head: "abcdefghij"
rope_tail: "abcdefghij"

elm-0.19.2

passran in 42 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
rope_len: 140000
rope_head: "abcdefghij"
rope_tail: "abcdefghij"

elm-0.19.3

passran in 52 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
rope_len: 140000
rope_head: "abcdefghij"
rope_tail: "abcdefghij"

lamdera-1.5.0

passran in 39 ms
Output
rope_len: 140000
rope_head: "abcdefghij"
rope_tail: "abcdefghij"

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringRopeContentTest exposing (main)
{-| Checks that a 140000-character string built by 1400 successive appends has the right length and intact content at both ends.
Each append adds `"abcdefghij"` repeated 10 times to the end of the
accumulator, so the first and the last ten characters must both be
`"abcdefghij"`.
-}
-- CHECK: rope_len: 140000
-- CHECK: rope_head: "abcdefghij"
-- CHECK: rope_tail: "abcdefghij"
import Html exposing (text)
main =
let
chunk =
String.repeat 10 "abcdefghij"
big =
List.foldl (\_ acc -> acc ++ chunk) "" (List.range 1 1400)
_ =
Debug.log "rope_len" (String.length big)
_ =
Debug.log "rope_head" (String.left 10 big)
_ =
Debug.log "rope_tail" (String.right 10 big)
in
text "done"