Skip to content

Commit

Permalink
benchmark against last published
Browse files Browse the repository at this point in the history
  • Loading branch information
lue-bird committed Dec 3, 2024
1 parent 06690eb commit bd72c3b
Show file tree
Hide file tree
Showing 3 changed files with 5,448 additions and 43 deletions.
42 changes: 25 additions & 17 deletions benchmark/src/Benchmarks.elm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import Elm.Parser
import Elm.Syntax.File
import Elm.Syntax.Range
import ElmSyntaxParserLenient
import ElmSyntaxParserLenientLastPublished
import ElmSyntaxPrintDefunctionalized
import ElmSyntaxPrintDefunctionalizedAttemptFaster
import ElmSyntaxPrintDefunctionalizedLastPublished
import Print
import Random

Expand All @@ -21,30 +22,30 @@ benchmarks =
[ Benchmark.describe "sample didn't parse" [] ]

Just sample ->
[ Benchmark.Alternative.rank "printing"
[ {-Benchmark.Alternative.rank "printing"
(\f -> f sample)
[ ( "current package implementation"
, moduleToStringCurrentPackage
)
, ( "attempt to make it faster"
, moduleToStringAttemptFaster
, ( "last published"
, moduleToStringLastPublished
)
]

{- },, Benchmark.Alternative.rank "elm-syntax Location compare"
]-}
Benchmark.Alternative.rank "parsing"
(\f -> f sampleModuleSource)
(\f -> f sample1ModuleSource)
[ --( "attempt at faster"
--, moduleToStringFasterIndent
--),
( "current elm-syntax implementation"
, parseModuleElmSyntax
)
, ( "current package implementation"
-- ( "current elm-syntax implementation"
-- , parseModuleElmSyntax
-- ),
( "current package implementation"
, parseModuleCurrentPackage
),
( "last published implementation"
, parseModuleLastPublished
)
]
-}
]
]
)

Expand Down Expand Up @@ -93,10 +94,10 @@ moduleToStringCurrentPackage syntaxModule =
|> Print.toString


moduleToStringAttemptFaster : Elm.Syntax.File.File -> String
moduleToStringAttemptFaster syntaxModule =
moduleToStringLastPublished : Elm.Syntax.File.File -> String
moduleToStringLastPublished syntaxModule =
syntaxModule
|> ElmSyntaxPrintDefunctionalizedAttemptFaster.module_
|> ElmSyntaxPrintDefunctionalizedLastPublished.module_
|> Print.toString


Expand All @@ -106,6 +107,13 @@ parseModuleCurrentPackage moduleSource =
|> ElmSyntaxParserLenient.run ElmSyntaxParserLenient.module_


parseModuleLastPublished : String -> Maybe Elm.Syntax.File.File
parseModuleLastPublished moduleSource =
moduleSource
|> ElmSyntaxParserLenientLastPublished.run
ElmSyntaxParserLenientLastPublished.module_


parseModuleElmSyntax : String -> Maybe Elm.Syntax.File.File
parseModuleElmSyntax moduleSource =
moduleSource
Expand Down
Loading

0 comments on commit bd72c3b

Please sign in to comment.