Skip to content

Commit

Permalink
Merge branch 'dev' into beat-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu authored Jan 27, 2025
2 parents a72228b + a4f5be6 commit 69a1b76
Show file tree
Hide file tree
Showing 86 changed files with 11,049 additions and 9,057 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create dependency bump PR
on:
# allows manual triggering from https://github.com/../../actions/workflows/bump.yml
workflow_dispatch:
# runs weekly on Thursday at 8:00
schedule:
- cron: '0 8 * * 4'

permissions:
contents: write
pull-requests: write

jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: nomeata/haskell-bounds-bump-action@main
with:
test: false


18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,20 @@ jobs:

- name: test
run: cabal v2-test ${{ matrix.versions.args }} --enable-tests --enable-benchmarks all

ormolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v17
with:
mode: inplace
pattern: |
src/**/*.hs
tidal-link/src/**/*.hs
tidal-parse/src/**/*.hs
tidal-listener/src/**/*.hs
- name: apply ormolu formatting
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ always() }}
with:
commit_message: automated ormolu reformatting
8 changes: 4 additions & 4 deletions .github/workflows/listener-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v2

- name: Setup Haskell
uses: haskell/actions/setup@v1
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand All @@ -31,7 +31,7 @@ jobs:
run: cabal freeze

- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
Expand All @@ -42,7 +42,7 @@ jobs:
- name: cabal update and build
run: |
cabal update
cabal build --enable-tests tidal-listener
cabal build --enable-tests --allow-newer tidal-listener
cabal build
- name: move GHC libs and configs
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
mv binary tidal
tar cvfj linux.tar tidal/*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: tidal-listener/linux.tar

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/listener-build-macosx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v2

- name: Setup Haskell
uses: haskell/actions/setup@v1
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand All @@ -32,7 +32,7 @@ jobs:
cabal freeze
- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
cd tidal-listener/
tar cvfj macosx.tar binary/*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: tidal-listener/macosx.tar

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/listener-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v2

- name: Setup Haskell
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand All @@ -32,7 +32,7 @@ jobs:
cabal freeze
- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- name: zip files
run: Compress-Archive -LiteralPath 'tidal-listener\binary\' -DestinationPath 'tidal-listener\windows.zip'

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: tidal-listener\windows.zip

Expand Down
1 change: 1 addition & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Distribution.Simple

main = defaultMain
10 changes: 5 additions & 5 deletions bench/Memory/Main.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Main where
module Main where

import Weigh
import Tidal.UIB
import Weigh

main :: IO ()
main =
mainWith $ do
main :: IO ()
main =
mainWith $ do
euclidB
fixB
40 changes: 20 additions & 20 deletions bench/Memory/Tidal/Inputs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

module Tidal.Inputs where

import Sound.Tidal.Pattern
import Sound.Tidal.Control
import Sound.Tidal.Core
import Sound.Tidal.ParseBP()
import Sound.Tidal.Params
import Sound.Tidal.Control
import Sound.Tidal.ParseBP ()
import Sound.Tidal.Pattern
import Sound.Tidal.UI
import Weigh

Expand All @@ -15,19 +15,19 @@ columns = setColumns [Case, Allocated, Max, Live, GCs]

{- Pattern inputs -}
xs3 :: [Time]
xs3 = [1..10000]
xs3 = [1 .. 10000]

xs4 :: [Time]
xs4 = [1..100000]
xs4 = [1 .. 100000]

xs5 :: [Time]
xs5 = [1..1000000]
xs5 = [1 .. 1000000]

xs6 :: [Time]
xs6 = [1..10000000]
xs6 = [1 .. 10000000]

xsA :: [Time]
xsA = [500000..1500000]
xsA = [500000 .. 1500000]

catPattSmall :: [Pattern Time]
catPattSmall = pure <$> xs3
Expand Down Expand Up @@ -72,18 +72,18 @@ fixArg1 = pF "cc64" 1

fixArg2 :: ControlPattern
fixArg2 =
fix ( # crush 4 ) (pF "cc65" 1)
$ fix ( stut' 4 (0.125/4) ( + up "1" )) (pF "cc66" 1)
$ fix ( |*| speed "-1" ) (pF "cc67" 1)
$ fix ( (# delaytime 0.125).(# delay 0.5)) (pF "cc68" 1)
$ fix ( # coarse 12) (pF "cc69" 1)
$ s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
#  pF "cc69" (cF 0 "69")
fix (# crush 4) (pF "cc65" 1) $
fix (stut' 4 (0.125 / 4) (+ up "1")) (pF "cc66" 1) $
fix (|*| speed "-1") (pF "cc67" 1) $
fix ((# delaytime 0.125) . (# delay 0.5)) (pF "cc68" 1) $
fix (# coarse 12) (pF "cc69" 1) $
s "[808bd:1(3,8), dr(7,8)]"
# pF "cc64" (cF 0 "64")
# pF "cc65" (cF 0 "65")
# pF "cc66" (cF 0 "66")
# pF "cc67" (cF 0 "67")
# pF "cc68" (cF 0 "68")
# pF "cc69" (cF 0 "69")

{- Euclid inputs -}
ecA1 :: [Pattern Int]
Expand Down
18 changes: 9 additions & 9 deletions bench/Memory/Tidal/UIB.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module Tidal.UIB where
module Tidal.UIB where

import Weigh
import Tidal.Inputs
import Sound.Tidal.Context
import Tidal.Inputs
import Weigh

fixB :: Weigh ()
fixB =
fixB :: Weigh ()
fixB =
wgroup "fix weigh" $ do
columns
func "fix 1" (fix (fast 2) fixArg1) fixArg2

euclidB :: Weigh ()
euclidB =
wgroup "euclid" $ do
columns
euclidB :: Weigh ()
euclidB =
wgroup "euclid" $ do
columns
func "euclid" (euclid (head ecA1) (head $ drop 1 ecA1)) ecA2
func "euclidFull" (euclidFull (head ecA1) (head $ drop 1 ecA1) ecA2) ecA2
func "euclidBool" (_euclidBool 1) 100000
12 changes: 6 additions & 6 deletions bench/Speed/Main.hs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module Main where

import Criterion.Main
import Tidal.PatternB
import Criterion.Main
import Tidal.CoreB
import Tidal.PatternB
import Tidal.UIB

patternBs :: [IO ()]
patternBs :: [IO ()]
patternBs = defaultMain <$> [withQueryTimeB, withQueryArcB, withResultArcB, withQueryTimeB, subArcB]

coreBs :: [IO ()]
coreBs :: [IO ()]
coreBs = defaultMain <$> [fromListB, stackB, appendB, concatB, _fastB]

uiBs :: [IO ()]
uiBs = defaultMain <$> [euclidB, fixB]

main :: IO ()
main = do
_ <- sequence coreBs
main = do
_ <- sequence coreBs
_ <- sequence patternBs
_ <- sequence uiBs
return ()
82 changes: 46 additions & 36 deletions bench/Speed/Tidal/CoreB.hs
Original file line number Diff line number Diff line change
@@ -1,50 +1,60 @@
module Tidal.CoreB where
module Tidal.CoreB where

import Criterion.Main
import Tidal.Inputs
import Criterion.Main
import Sound.Tidal.Core
import Sound.Tidal.Pattern
import Sound.Tidal.Core
import Tidal.Inputs

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

concatB :: [Benchmark]
concatB =
[ bgroup "concat" [
bench "fastCat 10^3" $ whnf fastCat catPattSmall
, bench "fastCat 10^4" $ whnf fastCat catPattMed
, bench "fastCat 10^5" $ whnf fastCat catPattMedB
, bench "fastCat 10^6" $ whnf fastCat catPattBig
, bench "timeCat 10^5" $ whnf timeCat timeCatMed
, bench "timeCat 10^6" $ whnf timeCat timeCatBig ]
concatB :: [Benchmark]
concatB =
[ bgroup
"concat"
[ bench "fastCat 10^3" $ whnf fastCat catPattSmall,
bench "fastCat 10^4" $ whnf fastCat catPattMed,
bench "fastCat 10^5" $ whnf fastCat catPattMedB,
bench "fastCat 10^6" $ whnf fastCat catPattBig,
bench "timeCat 10^5" $ whnf timeCat timeCatMed,
bench "timeCat 10^6" $ whnf timeCat timeCatBig
]
]

fromListB :: [Benchmark]
fromListB =
[ bgroup "fromList" [
bench "fromList" $ whnf fromList xs6
, bench "fromList nf" $ nf fromList xs6
, bench "fastFromList 10^3" $ whnf fastFromList xs3
, bench "fastFromList 10^4" $ whnf fastFromList xs4
, bench "fastFromList 10^5" $ whnf fastFromList xs5
, bench "fastFromList 10^6" $ whnf fastFromList xs6
, bench "fastFromList 10^6 nf" $ nf fastFromList xs6 ]
fromListB =
[ bgroup
"fromList"
[ bench "fromList" $ whnf fromList xs6,
bench "fromList nf" $ nf fromList xs6,
bench "fastFromList 10^3" $ whnf fastFromList xs3,
bench "fastFromList 10^4" $ whnf fastFromList xs4,
bench "fastFromList 10^5" $ whnf fastFromList xs5,
bench "fastFromList 10^6" $ whnf fastFromList xs6,
bench "fastFromList 10^6 nf" $ nf fastFromList xs6
]
]

appendB :: [Benchmark]
appendB =
[ bgroup "append" [
bench "append" $ whnf (append pattApp1) pattApp2
, bench "fastAppend" $ whnf (fastAppend pattApp1) pattApp2 ]
appendB :: [Benchmark]
appendB =
[ bgroup
"append"
[ bench "append" $ whnf (append pattApp1) pattApp2,
bench "fastAppend" $ whnf (fastAppend pattApp1) pattApp2
]
]

stackB :: [Benchmark]
stackB =
[ bgroup "stack" [
bench "overlay" $ whnf (overlay pattApp1) pattApp2
, bench "stack" $ whnf stack catPattBig ]
stackB :: [Benchmark]
stackB =
[ bgroup
"stack"
[ bench "overlay" $ whnf (overlay pattApp1) pattApp2,
bench "stack" $ whnf stack catPattBig
]
]
Loading

0 comments on commit 69a1b76

Please sign in to comment.