Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delint benchmarks #1177

Merged
merged 2 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions bench/Memory/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@

module Tidal.Inputs where

import Sound.Tidal.Control
import Sound.Tidal.Core
import Sound.Tidal.Control (stut')
import Sound.Tidal.Core (cF, fromList, (#), (|*|))
import Sound.Tidal.Params
( coarse,
crush,
delay,
delaytime,
pF,
s,
speed,
up,
)
import Sound.Tidal.ParseBP ()
import Sound.Tidal.Pattern
import Sound.Tidal.UI
( Arc,
ArcF (Arc),
ControlPattern,
Pattern,
Time,
)
import Sound.Tidal.UI (fix)
import Weigh
( Column (Allocated, Case, GCs, Live, Max),
Weigh,
setColumns,
)

columns :: Weigh ()
columns = setColumns [Case, Allocated, Max, Live, GCs]
Expand Down
14 changes: 10 additions & 4 deletions bench/Memory/Tidal/UIB.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
module Tidal.UIB where

import Sound.Tidal.Context
import Tidal.Inputs
import Weigh
( euclid,
euclidFull,
fast,
fix,
_euclidBool,
)
import Tidal.Inputs (columns, ecA1, ecA2, fixArg1, fixArg2)
import Weigh (Weigh, func, wgroup)

fixB :: Weigh ()
fixB =
Expand All @@ -14,6 +20,6 @@
euclidB =
wgroup "euclid" $ do
columns
func "euclid" (euclid (head ecA1) (head $ Prelude.drop 1 ecA1)) ecA2
func "euclidFull" (euclidFull (head ecA1) (head $ Prelude.drop 1 ecA1) ecA2) ecA2
func "euclid" (euclid (head ecA1) (ecA1 !! 1)) ecA2

Check warning on line 23 in bench/Memory/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

In the use of ‘head’

Check warning on line 23 in bench/Memory/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal 3.12.1.0 - ghc 9.8.2

In the use of ‘head’
func "euclidFull" (euclidFull (head ecA1) (ecA1 !! 1) ecA2) ecA2

Check warning on line 24 in bench/Memory/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

In the use of ‘head’

Check warning on line 24 in bench/Memory/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal 3.12.1.0 - ghc 9.8.2

In the use of ‘head’
func "euclidBool" (_euclidBool 1) 100000
29 changes: 26 additions & 3 deletions bench/Speed/Tidal/CoreB.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
module Tidal.CoreB where

import Criterion.Main
import Criterion.Main (Benchmark, bench, bgroup, nf, whnf)
import Sound.Tidal.Core
import Sound.Tidal.Pattern
( append,
cat,
fastAppend,
fastCat,
fastFromList,
fromList,
overlay,
stack,
timeCat,
)
import Sound.Tidal.Pattern (toTime, _fast)
import Tidal.Inputs
( catPattBig,
catPattMed,
catPattMedB,
catPattSmall,
pattApp1,
pattApp2,
timeCatBig,
timeCatMed,
xs3,
xs4,
xs5,
xs6,
)

_fastB :: [Benchmark]
_fastB =
[ bgroup
"_fast"
[ bench "_fast < 0" $ whnf (_fast (-2)) pattApp2,
bench "_fast > 0" $ whnf (_fast (toTime $ 10 ^ 6)) (cat catPattBig)
bench "_fast > 0" $ whnf (_fast (toTime $ (10 :: Int) ^ (6 :: Int))) (cat catPattBig)
]
]

Expand Down
18 changes: 16 additions & 2 deletions bench/Speed/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@

module Tidal.Inputs where

import Sound.Tidal.Core
import Sound.Tidal.Core (cF, fromList, (#), (|*|))
import Sound.Tidal.Params
( coarse,
crush,
delay,
delaytime,
pF,
s,
speed,
)
import Sound.Tidal.ParseBP ()
import Sound.Tidal.Pattern
import Sound.Tidal.UI
( Arc,
ArcF (Arc),
ControlPattern,
Pattern,
Time,
)
import Sound.Tidal.UI (fix)

{- Pattern inputs -}
xs3 :: [Time]
Expand Down
17 changes: 15 additions & 2 deletions bench/Speed/Tidal/PatternB.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
module Tidal.PatternB where

import Criterion.Main
import Criterion.Main (Benchmark, bench, bgroup, nf, whnf)
import Sound.Tidal.Pattern
import Tidal.Inputs
( ArcF (Arc),
Time,
hull,
sect,
subArc,
withQueryArc,
withQueryTime,
withResultArc,
)
import Tidal.Inputs (arcFunc, wqaBig, wqaMed)

arc1 :: ArcF Time
arc1 = Arc 3 5

arc2 :: ArcF Time
arc2 = Arc 4 6

arc3 :: ArcF Time
arc3 = Arc 0 1

arc4 :: ArcF Time
arc4 = Arc 1 2

withQueryTimeB :: [Benchmark]
Expand Down
14 changes: 10 additions & 4 deletions bench/Speed/Tidal/UIB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

module Tidal.UIB where

import Criterion.Main
import Criterion.Main (Benchmark, bench, bgroup, nf, whnf)
import Sound.Tidal.Context
import Tidal.Inputs
( euclid,
euclidFull,
fast,
fix,
_euclidBool,
)
import Tidal.Inputs (ecA1, ecA2, fixArg1, fixArg2)

fixB :: [Benchmark]
fixB =
Expand All @@ -19,8 +25,8 @@
euclidB =
[ bgroup
"euclid"
[ bench "euclid" $ whnf (euclid (head ecA1) (head $ Prelude.drop 1 ecA1)) ecA2,
bench "euclidFull" $ whnf (euclidFull (head ecA1) (head $ Prelude.drop 1 ecA1) ecA2) ecA2,
[ bench "euclid" $ whnf (euclid (head ecA1) (ecA1 !! 1)) ecA2,

Check warning on line 28 in bench/Speed/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

In the use of ‘head’

Check warning on line 28 in bench/Speed/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal 3.12.1.0 - ghc 9.8.2

In the use of ‘head’
bench "euclidFull" $ whnf (euclidFull (head ecA1) (ecA1 !! 1) ecA2) ecA2,

Check warning on line 29 in bench/Speed/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal latest - ghc latest

In the use of ‘head’

Check warning on line 29 in bench/Speed/Tidal/UIB.hs

View workflow job for this annotation

GitHub Actions / cabal 3.12.1.0 - ghc 9.8.2

In the use of ‘head’
bench "euclidBool" $ whnf (_euclidBool 1) 100000
]
]
Loading