Skip to content
Open
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
20 changes: 20 additions & 0 deletions .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,23 @@ jobs:
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-runtest@master
benchmark:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1', 'nightly']
julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86

steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: "Benchmark iters"
run: |
julia -e "import Pkg; Pkg.develop(Pkg.PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.add(\"BenchmarkTools\"); Pkg.update();"
julia test/benchmark.jl
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ version = "1.3.0"
[deps]
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1"

[extras]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Test", "BenchmarkTools"]
42 changes: 42 additions & 0 deletions test/benchmark.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using ProgressBars, Test
using BenchmarkTools

counter = 0
function iterate(delay::Float64)
global counter = 0
for i in ProgressBar(1:1000000, printing_delay=delay, leave=false)
global counter += i
end
end

function standard()
global counter = 0
for i in 1:1000000
global counter += 1
end
end

println(stderr, "Benchmarking ProgressBar with 1M iters and printing_delay=0.2")
results = @benchmark iterate(0.2)
display(results)
@test true

println(stderr, "\nBenchmarking ProgressBar with 1M iters and printing_delay=0.1")
results = @benchmark iterate(0.2)
display(results)
@test true

println(stderr, "\nBenchmarking ProgressBar with 1M iters and printing_delay=0.05")
results = @benchmark iterate(0.05)
display(results)
@test true

println(stderr, "\nBenchmarking ProgressBar with 1M iters and printing_delay=0.00001")
results = @benchmark iterate(0.00001)
display(results)
@test true

println(stderr, "\nStandard 1M iterator in Julia")
results = @benchmark standard()
display(results)
@test true