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

LinearStretching enhancements #28

Merged
merged 14 commits into from
Mar 27, 2020
Merged

LinearStretching enhancements #28

merged 14 commits into from
Mar 27, 2020

Conversation

johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented Mar 17, 2020

It's just a prototype for #27 , does this usage look good to you?

img = float.(testimage("mandril_gray"))
imgo = adjust_histogram(img, LinearStretching(src_minval=0.1, src_maxval=0.9))

Note that this implementation doesn't always work for N0f8 types, there're two ways to work this around: clamp01 or promote storage type. I'm not sure which is better.

cc: @zygmuntszpak @bjarthur

@codecov
Copy link

codecov bot commented Mar 17, 2020

Codecov Report

Merging #28 into master will increase coverage by 0.05%.
The diff coverage is 97.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   95.81%   95.86%   +0.05%     
==========================================
  Files          14       14              
  Lines         454      484      +30     
==========================================
+ Hits          435      464      +29     
- Misses         19       20       +1
Impacted Files Coverage Δ
src/algorithms/common.jl 100% <ø> (ø) ⬆️
src/algorithms/linear_stretching.jl 95.65% <97.36%> (+2.31%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80a03fe...a254af4. Read the comment docs.

@bjarthur
Copy link

great! in what cases doesn't it work for N0f8?

@johnnychen94
Copy link
Member Author

johnnychen94 commented Mar 19, 2020

in what cases doesn't it work for N0f8?

The kernel operation of linearstrech can be reduced to

out .= (b-a)/(B-A) * (X - (A*b-B*a)/(b-a))

where (A, B) are (src_minval, src_maxval) and (a, b) are (minval, maxval).

This expression says if finitemin(X) < (A*b-B*a)/(b-a), the output exceeds the [0, 1] range.

julia> imgo = adjust_histogram(img, LinearStretching(src_minval=0.1, src_maxval=0.9))
ERROR: ArgumentError: element type FixedPointNumbers.Normed{UInt8,8} is an 8-bit type representing 256 values from 0.0 to 1.0,
  but the values (-0.0024509803921568714,) do not lie within this range.
  See the READMEs for FixedPointNumbers and ColorTypes for more information.

Paremeters (src_minval, src_maxval) and (minval, maxval) are a little bit mutually exclusive for N0f8 types.

The simplest solution is to do clamp01 on the results, but that can be a breaking behavior for float types; not to mention the concept linear_stretch doesn't imply clamp01. Thus I don't like this solution.

My opinion is to:

  • if the user does not specify parameter, use default values: (0., 1., minfinite(img), maxfinite(img)).
  • if the user specifies either from or to, infer the other to make sure output value doesn't exceed range [0, 1]. -- this might not so trivial though...
  • if the user specifies both, throw a warning when the condition doesn't satisfied for N0f8 types. And let the user recheck the parameters or promote eltype to floats.

@bjarthur
Copy link

this issue should exist for all fixed-point types not just N0f8 IIUC.

imadjustintensity clamped the output to [0,1]. this precedent is/was intuitive to me.

however, i see your point. give the user the flexibility to stretch outside [0,1] and then clamp themselves if that is what they desire. and if they stretch into a type which can't support values outside [0,1], then either throw an error or promote.

maybe make clamping easy for them by having a clamp=false keyword arg?

@johnnychen94
Copy link
Member Author

johnnychen94 commented Mar 19, 2020

Recent changes (including 0572eb4):

  • performance tweak
  • clamp wrt (minval, maxval) -- This solves FixedPoint Issue

Performance tweak get ~10x speed up:

julia> img = testimage("mandril_gray");
julia> alg = LinearStretching();

# master
julia> @benchmark adjust_histogram($img, $alg)
BenchmarkTools.Trial:
  memory estimate:  256.19 KiB
  allocs estimate:  3
  --------------
  minimum time:     4.473 ms (0.00% GC)
  median time:      4.739 ms (0.00% GC)
  mean time:        4.804 ms (0.03% GC)
  maximum time:     7.016 ms (0.00% GC)
  --------------
  samples:          1041
  evals/sample:     1

# this PR
julia> @benchmark adjust_histogram($img, $alg)
BenchmarkTools.Trial:
  memory estimate:  256.14 KiB
  allocs estimate:  2
  --------------
  minimum time:     493.738 μs (0.00% GC)
  median time:      535.095 μs (0.00% GC)
  mean time:        550.216 μs (0.36% GC)
  maximum time:     2.837 ms (80.10% GC)
  --------------
  samples:          9068
  evals/sample:     1

More benchmark on this PR:

julia> img = testimage("mandril_gray");

julia> alg = LinearStretching();

julia> @btime adjust_histogram($img, $alg);
  483.575 μs (2 allocations: 256.14 KiB)

julia> @btime adjust_histogram($(float.(img)), $alg);
  880.483 μs (2 allocations: 1.00 MiB)

julia> alg = LinearStretching(src_minval=0.1, src_maxval=0.9);

# clamp contributes ~200μs for N0f8
julia> @btime adjust_histogram($img, $alg);
  670.129 μs (2 allocations: 256.14 KiB)

# but doesn't for Float32
julia> @btime adjust_histogram($(float.(img)), $alg);
  894.220 μs (2 allocations: 1.00 MiB)

@johnnychen94 johnnychen94 changed the title expose src_minval and src_maxval to users LinearStretching enhancements Mar 20, 2020
@johnnychen94 johnnychen94 marked this pull request as ready for review March 20, 2020 16:01
@johnnychen94
Copy link
Member Author

johnnychen94 commented Mar 20, 2020

@zygmuntszpak I think this PR is ready for review/merge, commits are rebased into two.

Summary:

@@ -2,7 +2,7 @@
"""
```
LinearStretching <: AbstractHistogramAdjustmentAlgorithm
LinearStretching(; minval = 0, maxval = 1)
LinearStretching(; minval = 0, maxval = 1, [src_minval], [src_maxval])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for symmetry, maybe minval and maxval should be dst_minval and dst_maxval ?

Copy link
Member Author

@johnnychen94 johnnychen94 Mar 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought about that once a while, then I think it's okay to keep the previous minval, maxval name since those are what most user needs.

And I guess adding another deprecation after imadjustintensity is kind of annoying to users...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure about "most users needs". i for one would only ever need to set src_{min,max}val. worth noting that matlab's equivalent function uses symmetrically named keyword args ({low,high}_{in,out}). i would also argue that naming them dst_{min,max}val would be more self-descriptive and hence act as documentation, both in the user-facing API and in the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree and the re-naming makes sense to me as well. I was just concerning how welcome/unwelcome this renaming will be.

I'm open to changes, but I'd like to first see how @zygmuntszpak thinks before I put my hands on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it is best to rename it to dst_minval and dst_maxval. Presumably, this means that we will have to amend the version number to become 0.4.0 to reflect the breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably, this means that we will have to amend the version number to become 0.4.0 to reflect the breaking change?

If we're on 1.x.y version, a minor version bump is needed. But since we're on 0.3.4 version, I think a patch version is also accepted.

When you deprecate part of your public API, you should do two things: (1) update your documentation to let users know about the change, (2) issue a new minor release with the deprecation in place
https://semver.org/#how-should-i-handle-deprecating-functionality

Copy link
Member Author

@johnnychen94 johnnychen94 Mar 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the deprecation of minval, maxval in favor of dest_minval, dest_maxval in a198016, I also introduced a new set of API in 5674568

  • specify (dest_minval, dest_maxval): LinearStretching(nothing=>(0, 1))
  • specify (src_minval, src_maxval): LinearStretching((0.1, 0.9))
  • specify both: LinearStretching((0.1, 0.9) => (0, 1))

Copy link
Member

@zygmuntszpak zygmuntszpak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for taking this up Johnny, I appreciate your time on it.

@@ -2,7 +2,7 @@
"""
```
LinearStretching <: AbstractHistogramAdjustmentAlgorithm
LinearStretching(; minval = 0, maxval = 1)
LinearStretching(; minval = 0, maxval = 1, [src_minval], [src_maxval])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it is best to rename it to dst_minval and dst_maxval. Presumably, this means that we will have to amend the version number to become 0.4.0 to reflect the breaking change?

* expose src_minval and src_maxval of LinearStretching ( issue #27)
* performance tweak by
  * avoiding recomputation in inner loop
  * early return for trivial case
* clamp values to (minval, maxval)
* LinearStretching((0.1, 0.8)=>(0.2, 0.9))
* LinearStretching(nothing=>(0.2, 0.9))
* LinearStretching((0.1, 0.8))
Although two new fields are introduced to LinearStretching, it doesn't
hurt the general performance; the construction time is about 3ns
@github-actions
Copy link
Contributor

Benchmark result

Judge result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmarks:
    • Target: 21 Mar 2020 - 22:01
    • Baseline: 21 Mar 2020 - 22:05
  • Package commits:
    • Target: de5407
    • Baseline: 80a03f
  • Julia commits:
    • Target: 2d5741
    • Baseline: 2d5741
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["ContrastStretching", "Gray{Float32}", "64×64"] 1.05 (5%) ❌ 1.00 (1%)
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 1.05 (5%) ❌ 1.00 (1%)
["ContrastStretching", "RGB{Float32}", "64×64"] 0.89 (5%) ✅ 1.00 (1%)
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 0.84 (5%) ✅ 1.00 (1%)
["GammaCorrection", "RGB{Float32}", "64×64"] 0.94 (5%) ✅ 1.00 (1%)
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 1.43 (5%) ❌ 1.00 (1%)
["LinearStretching", "Float32", "64×64"] 0.12 (5%) ✅ 1.00 (1%)
["LinearStretching", "Gray{Float32}", "64×64"] 2.80 (5%) ❌ 20.29 (1%) ❌
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 0.08 (5%) ✅ 4.85 (1%) ❌
["LinearStretching", "Normed{UInt8,8}", "64×64"] 0.08 (5%) ✅ 4.82 (1%) ❌
["LinearStretching", "RGB{Float32}", "64×64"] 0.43 (5%) ✅ 1.00 (1%)
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 0.59 (5%) ✅ 1.00 (1%)
["Matching", "RGB{Float32}", "64×64"] 1.45 (5%) ❌ 1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Target

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2095 MHz      30768 s          0 s       1574 s      27229 s          0 s
       #2  2095 MHz      26622 s          0 s       1628 s      32182 s          0 s
       
  Memory: 6.782737731933594 GB (3573.49609375 MB free)
  Uptime: 619.0 sec
  Load Avg:  1.0  0.93701171875  0.56787109375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Baseline

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2095 MHz      31579 s          0 s       1692 s      46861 s          0 s
       #2  2095 MHz      46453 s          0 s       1768 s      32807 s          0 s
       
  Memory: 6.782737731933594 GB (3509.75390625 MB free)
  Uptime: 826.0 sec
  Load Avg:  1.0  0.974609375  0.662109375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Target result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 21 Mar 2020 - 22:1
  • Package commit: de5407
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 16.919 ms (5%) 1.907 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 17.139 ms (5%) 2.004 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 18.507 ms (5%) 2.107 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 17.803 ms (5%) 1.774 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 17.290 ms (5%) 1.982 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 17.259 ms (5%) 1.991 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 147.900 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 151.200 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 154.500 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 157.400 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 316.101 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 385.701 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 76.801 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 69.801 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 78.700 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 77.500 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 248.501 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 365.601 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 129.400 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 255.402 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 6.880 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 150.400 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 306.502 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 429.302 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 15.000 μs (5%) 16.13 KiB (1%) 1
["LinearStretching", "Gray{Float32}", "64×64"] 340.203 μs (5%) 328.14 KiB (1%) 19970
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 9.700 μs (5%) 20.52 KiB (1%) 12
["LinearStretching", "Normed{UInt8,8}", "64×64"] 9.200 μs (5%) 20.41 KiB (1%) 8
["LinearStretching", "RGB{Float32}", "64×64"] 130.601 μs (5%) 112.48 KiB (1%) 9
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 251.701 μs (5%) 76.53 KiB (1%) 8
["Matching", "Float32", "64×64"] 421.301 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 444.701 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 440.501 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 403.602 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 827.502 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 950.603 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2095 MHz      30768 s          0 s       1574 s      27229 s          0 s
       #2  2095 MHz      26622 s          0 s       1628 s      32182 s          0 s
       
  Memory: 6.782737731933594 GB (3573.49609375 MB free)
  Uptime: 619.0 sec
  Load Avg:  1.0  0.93701171875  0.56787109375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Baseline result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 21 Mar 2020 - 22:5
  • Package commit: 80a03f
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 16.777 ms (5%) 1.797 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 17.078 ms (5%) 1.822 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 17.827 ms (5%) 1.845 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 18.474 ms (5%) 2.051 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 17.538 ms (5%) 1.915 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 17.359 ms (5%) 1.874 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 147.700 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 143.700 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 156.500 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 149.200 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 353.800 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 459.501 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 76.500 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 69.400 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 78.500 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 77.700 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 245.600 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 364.200 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 129.800 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 250.300 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 6.700 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 150.300 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 326.100 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 299.401 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 126.500 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Float32}", "64×64"] 121.700 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 116.701 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "Normed{UInt8,8}", "64×64"] 118.900 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "RGB{Float32}", "64×64"] 303.300 μs (5%) 112.53 KiB (1%) 10
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 424.200 μs (5%) 76.58 KiB (1%) 9
["Matching", "Float32", "64×64"] 421.600 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 441.200 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 438.001 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 401.600 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 570.500 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 946.301 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2095 MHz      31579 s          0 s       1692 s      46861 s          0 s
       #2  2095 MHz      46453 s          0 s       1768 s      32807 s          0 s
       
  Memory: 6.782737731933594 GB (3509.75390625 MB free)
  Uptime: 826.0 sec
  Load Avg:  1.0  0.974609375  0.662109375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Runtime information

Runtime Info
BLAS #threads 2
BLAS.vendor() openblas64
Sys.CPU_THREADS 2

lscpu output:

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  1
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
Stepping:            4
CPU MHz:             2095.080
BogoMIPS:            4190.16
Hypervisor vendor:   Microsoft
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            36608K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec xsaves
Cpu Property Value
Brand Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
Vendor :Intel
Architecture :Skylake
Model Family: 0x06, Model: 0x55, Stepping: 0x04, Type: 0x00
Cores 2 physical cores, 2 logical cores (on executing CPU)
No Hyperthreading detected
Clock Frequencies Not supported by CPU
Data Cache Level 1:3 : (32, 1024, 36608) kbytes
64 byte cache line size
Address Size 48 bits virtual, 44 bits physical
SIMD 512 bit = 64 byte max. SIMD vector size
Time Stamp Counter TSC is accessible via rdtsc
TSC increased at every clock cycle (non-invariant TSC)
Perf. Monitoring Performance Monitoring Counters (PMC) are not supported
Hypervisor Yes, Microsoft

@johnnychen94
Copy link
Member Author

Hmmm, Gray{Float32} performance regression on Gray{Float32} is really unexpected 🤔

@github-actions
Copy link
Contributor

Benchmark result

Judge result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmarks:
    • Target: 21 Mar 2020 - 22:40
    • Baseline: 21 Mar 2020 - 22:43
  • Package commits:
    • Target: fb3e9c
    • Baseline: 80a03f
  • Julia commits:
    • Target: 2d5741
    • Baseline: 2d5741
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["AdaptiveEqualization", "Float32", "64×64"] 0.87 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 1.08 (5%) ❌ 1.00 (1%)
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 0.91 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 0.86 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 0.92 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 0.89 (5%) ✅ 1.00 (1%)
["ContrastStretching", "RGB{Float32}", "64×64"] 1.13 (5%) ❌ 1.00 (1%)
["Equalization", "RGB{Float32}", "64×64"] 0.93 (5%) ✅ 1.00 (1%)
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 0.94 (5%) ✅ 1.00 (1%)
["GammaCorrection", "Gray{Float32}", "64×64"] 1.12 (5%) ❌ 1.00 (1%)
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 1.09 (5%) ❌ 1.00 (1%)
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 0.94 (5%) ✅ 1.00 (1%)
["LinearStretching", "Float32", "64×64"] 0.18 (5%) ✅ 1.00 (1%)
["LinearStretching", "Gray{Float32}", "64×64"] 0.21 (5%) ✅ 1.00 (1%)
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 0.19 (5%) ✅ 4.80 (1%) ❌
["LinearStretching", "Normed{UInt8,8}", "64×64"] 0.12 (5%) ✅ 4.82 (1%) ❌
["LinearStretching", "RGB{Float32}", "64×64"] 0.46 (5%) ✅ 1.00 (1%)
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 0.60 (5%) ✅ 1.00 (1%)
["Matching", "Float32", "64×64"] 0.95 (5%) ✅ 1.00 (1%)
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 0.95 (5%) ✅ 1.00 (1%)
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 0.93 (5%) ✅ 1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Target

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      47810 s          0 s       1558 s      14108 s          0 s
       #2  2294 MHz       9132 s          0 s       1662 s      52396 s          0 s
       
  Memory: 6.782737731933594 GB (3532.453125 MB free)
  Uptime: 650.0 sec
  Load Avg:  1.111328125  0.97509765625  0.56884765625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Baseline

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      66174 s          0 s       1645 s      15876 s          0 s
       #2  2294 MHz      10972 s          0 s       1841 s      70613 s          0 s
       
  Memory: 6.782737731933594 GB (3491.703125 MB free)
  Uptime: 853.0 sec
  Load Avg:  1.08447265625  1.03564453125  0.68212890625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Target result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 21 Mar 2020 - 22:40
  • Package commit: fb3e9c
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 15.746 ms (5%) 2.036 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 18.062 ms (5%) 2.684 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 17.248 ms (5%) 2.183 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 16.234 ms (5%) 2.131 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 16.609 ms (5%) 2.296 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 16.392 ms (5%) 2.267 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 114.900 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 114.801 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 114.801 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 118.200 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 351.102 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 326.902 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 52.500 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 54.601 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 56.400 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 52.600 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 235.702 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 258.502 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 102.501 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 218.702 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 5.217 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 118.601 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 290.703 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 301.102 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 16.300 μs (5%) 16.13 KiB (1%) 1
["LinearStretching", "Gray{Float32}", "64×64"] 18.600 μs (5%) 16.13 KiB (1%) 1
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 15.000 μs (5%) 20.31 KiB (1%) 2
["LinearStretching", "Normed{UInt8,8}", "64×64"] 10.000 μs (5%) 20.41 KiB (1%) 8
["LinearStretching", "RGB{Float32}", "64×64"] 129.401 μs (5%) 112.48 KiB (1%) 9
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 176.701 μs (5%) 76.53 KiB (1%) 8
["Matching", "Float32", "64×64"] 286.002 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 282.601 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 276.802 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 269.302 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 754.504 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 687.804 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      47810 s          0 s       1558 s      14108 s          0 s
       #2  2294 MHz       9132 s          0 s       1662 s      52396 s          0 s
       
  Memory: 6.782737731933594 GB (3532.453125 MB free)
  Uptime: 650.0 sec
  Load Avg:  1.111328125  0.97509765625  0.56884765625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Baseline result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 21 Mar 2020 - 22:43
  • Package commit: 80a03f
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 18.148 ms (5%) 2.152 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 16.740 ms (5%) 1.814 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 18.975 ms (5%) 2.171 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 18.890 ms (5%) 2.127 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 18.123 ms (5%) 1.939 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 18.389 ms (5%) 2.154 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 115.501 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 114.801 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 114.801 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 117.101 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 312.001 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 318.802 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 55.200 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 55.401 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 54.001 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 52.800 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 253.602 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 275.701 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 103.000 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 195.300 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 4.800 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 115.101 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 294.302 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 320.501 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 89.701 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Float32}", "64×64"] 89.800 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 80.200 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "Normed{UInt8,8}", "64×64"] 82.700 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "RGB{Float32}", "64×64"] 281.802 μs (5%) 112.53 KiB (1%) 10
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 296.102 μs (5%) 76.58 KiB (1%) 9
["Matching", "Float32", "64×64"] 302.601 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 284.501 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 292.501 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 268.101 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 776.503 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 741.704 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      66174 s          0 s       1645 s      15876 s          0 s
       #2  2294 MHz      10972 s          0 s       1841 s      70613 s          0 s
       
  Memory: 6.782737731933594 GB (3491.703125 MB free)
  Uptime: 853.0 sec
  Load Avg:  1.08447265625  1.03564453125  0.68212890625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Runtime information

Runtime Info
BLAS #threads 2
BLAS.vendor() openblas64
Sys.CPU_THREADS 2

lscpu output:

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  1
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               79
Model name:          Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Stepping:            1
CPU MHz:             2294.691
BogoMIPS:            4589.38
Hypervisor vendor:   Microsoft
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            51200K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt md_clear
Cpu Property Value
Brand Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Vendor :Intel
Architecture :Broadwell
Model Family: 0x06, Model: 0x4f, Stepping: 0x01, Type: 0x00
Cores 2 physical cores, 2 logical cores (on executing CPU)
No Hyperthreading detected
Clock Frequencies Not supported by CPU
Data Cache Level 1:3 : (32, 256, 51200) kbytes
64 byte cache line size
Address Size 48 bits virtual, 44 bits physical
SIMD 256 bit = 32 byte max. SIMD vector size
Time Stamp Counter TSC is accessible via rdtsc
TSC increased at every clock cycle (non-invariant TSC)
Perf. Monitoring Performance Monitoring Counters (PMC) are not supported
Hypervisor Yes, Microsoft

@johnnychen94
Copy link
Member Author

johnnychen94 commented Mar 21, 2020

Benchmark after 65c7c22:

  • the N0f8 version is faster: from 500 μs to 260 μs
  • float version isn't changed
  • performances are almost the same with/without clamp: previously the clamp version is ~200 μs slower for N0f8
julia> img = testimage("mandril_gray");

julia> alg = LinearStretching();
julia> @btime adjust_histogram($img, $alg);
  265.302 μs (6 allocations: 1.25 MiB)
julia> @btime adjust_histogram($(float.(img)), $alg);
  909.417 μs (2 allocations: 1.00 MiB)
julia> @btime adjust_histogram($(Float32.(img)), $alg);
  879.758 μs (2 allocations: 1.00 MiB)

julia> alg = LinearStretching((0.1f0, 0.9f0));
julia> @btime adjust_histogram($img, $alg);
  275.747 μs (6 allocations: 1.25 MiB)
julia> @btime adjust_histogram($(float.(img)), $alg);
  882.314 μs (2 allocations: 1.00 MiB)
julia> @btime adjust_histogram($(Float32.(img)), $alg);
  880.484 μs (2 allocations: 1.00 MiB)

I think it's ready to merge (with squash) if there aren't more suggestions.

The color version might need more tweaks (e.g., don't convert to YIQ space for RGB images) , there might be more optimization space for the float version... but I'll leave it to other PRs.

As a reference, here's the performance of imadjustintensity:

julia> img = testimage("mandril_gray");
julia> @btime imadjustintensity($img);
  1.146 ms (4 allocations: 256.20 KiB)
julia> @btime imadjustintensity($(float.(img)));
  1.175 ms (4 allocations: 1.00 MiB)
julia> @btime imadjustintensity($img, (0.1, 0.9));
  605.017 μs (3 allocations: 256.17 KiB)
julia> @btime imadjustintensity($(float.(img)), (0.1, 0.9));
  341.675 μs (3 allocations: 1.00 MiB) 👀 

travis CI failures on macos are unrelated.

@github-actions
Copy link
Contributor

Benchmark result

Judge result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmarks:
    • Target: 21 Mar 2020 - 22:58
    • Baseline: 21 Mar 2020 - 23:02
  • Package commits:
    • Target: b40c2d
    • Baseline: 80a03f
  • Julia commits:
    • Target: 2d5741
    • Baseline: 2d5741
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["AdaptiveEqualization", "Float32", "64×64"] 1.07 (5%) ❌ 1.00 (1%)
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 1.13 (5%) ❌ 1.00 (1%)
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 1.16 (5%) ❌ 1.00 (1%)
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 1.14 (5%) ❌ 1.00 (1%)
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 1.18 (5%) ❌ 1.00 (1%)
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 1.22 (5%) ❌ 1.00 (1%)
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 0.94 (5%) ✅ 1.00 (1%)
["Equalization", "Gray{Float32}", "64×64"] 1.07 (5%) ❌ 1.00 (1%)
["Equalization", "Normed{UInt8,8}", "64×64"] 1.06 (5%) ❌ 1.00 (1%)
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 1.07 (5%) ❌ 1.00 (1%)
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 1.13 (5%) ❌ 1.00 (1%)
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 1.07 (5%) ❌ 1.00 (1%)
["LinearStretching", "Float32", "64×64"] 0.18 (5%) ✅ 1.00 (1%)
["LinearStretching", "Gray{Float32}", "64×64"] 0.22 (5%) ✅ 1.00 (1%)
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 0.12 (5%) ✅ 4.80 (1%) ❌
["LinearStretching", "Normed{UInt8,8}", "64×64"] 0.12 (5%) ✅ 4.82 (1%) ❌
["LinearStretching", "RGB{Float32}", "64×64"] 0.46 (5%) ✅ 1.00 (1%)
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 0.60 (5%) ✅ 1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Target

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      44946 s          0 s       1550 s      11821 s          0 s
       #2  2294 MHz       9681 s          0 s       1506 s      46549 s          0 s
       
  Memory: 6.782737731933594 GB (3510.703125 MB free)
  Uptime: 596.0 sec
  Load Avg:  1.080078125  0.9765625  0.59521484375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Baseline

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      58441 s          0 s       1638 s      17578 s          0 s
       #2  2294 MHz      15497 s          0 s       1665 s      59963 s          0 s
       
  Memory: 6.782737731933594 GB (3556.40234375 MB free)
  Uptime: 791.0 sec
  Load Avg:  1.1689453125  1.1044921875  0.73046875
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Target result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 21 Mar 2020 - 22:58
  • Package commit: b40c2d
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 15.465 ms (5%) 1.869 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 16.480 ms (5%) 2.293 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 17.517 ms (5%) 2.294 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 16.934 ms (5%) 2.016 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 17.424 ms (5%) 2.140 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 18.014 ms (5%) 2.387 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 114.801 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 115.100 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 114.700 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 118.300 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 311.101 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 318.101 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 49.000 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 55.400 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 52.700 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 55.500 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 233.201 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 274.401 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 103.400 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 202.200 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 5.017 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 132.400 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 302.500 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 329.000 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 16.300 μs (5%) 16.13 KiB (1%) 1
["LinearStretching", "Gray{Float32}", "64×64"] 19.500 μs (5%) 16.13 KiB (1%) 1
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 9.900 μs (5%) 20.34 KiB (1%) 4
["LinearStretching", "Normed{UInt8,8}", "64×64"] 10.000 μs (5%) 20.41 KiB (1%) 8
["LinearStretching", "RGB{Float32}", "64×64"] 129.300 μs (5%) 112.48 KiB (1%) 9
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 175.901 μs (5%) 76.53 KiB (1%) 8
["Matching", "Float32", "64×64"] 284.801 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 283.201 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 276.101 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 267.901 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 727.503 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 675.402 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      44946 s          0 s       1550 s      11821 s          0 s
       #2  2294 MHz       9681 s          0 s       1506 s      46549 s          0 s
       
  Memory: 6.782737731933594 GB (3510.703125 MB free)
  Uptime: 596.0 sec
  Load Avg:  1.080078125  0.9765625  0.59521484375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Baseline result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 21 Mar 2020 - 23:2
  • Package commit: 80a03f
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 14.464 ms (5%) 1.613 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 14.631 ms (5%) 1.895 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 15.038 ms (5%) 1.810 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 14.887 ms (5%) 1.622 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 14.761 ms (5%) 1.485 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 14.731 ms (5%) 1.697 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 114.100 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 111.500 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 114.900 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 125.300 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 310.800 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 316.901 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 48.700 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 52.000 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 52.900 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 52.400 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 233.901 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 257.400 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 101.301 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 200.401 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 4.900 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 117.100 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 299.001 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 308.701 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 92.800 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Float32}", "64×64"] 88.000 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 79.700 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "Normed{UInt8,8}", "64×64"] 83.200 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "RGB{Float32}", "64×64"] 282.301 μs (5%) 112.53 KiB (1%) 10
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 294.801 μs (5%) 76.58 KiB (1%) 9
["Matching", "Float32", "64×64"] 285.401 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 279.600 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 274.301 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 267.900 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 723.901 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 676.201 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      58441 s          0 s       1638 s      17578 s          0 s
       #2  2294 MHz      15497 s          0 s       1665 s      59963 s          0 s
       
  Memory: 6.782737731933594 GB (3556.40234375 MB free)
  Uptime: 791.0 sec
  Load Avg:  1.1689453125  1.1044921875  0.73046875
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Runtime information

Runtime Info
BLAS #threads 2
BLAS.vendor() openblas64
Sys.CPU_THREADS 2

lscpu output:

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  1
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               79
Model name:          Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Stepping:            1
CPU MHz:             2294.686
BogoMIPS:            4589.37
Hypervisor vendor:   Microsoft
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            51200K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt md_clear
Cpu Property Value
Brand Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Vendor :Intel
Architecture :Broadwell
Model Family: 0x06, Model: 0x4f, Stepping: 0x01, Type: 0x00
Cores 2 physical cores, 2 logical cores (on executing CPU)
No Hyperthreading detected
Clock Frequencies Not supported by CPU
Data Cache Level 1:3 : (32, 256, 51200) kbytes
64 byte cache line size
Address Size 48 bits virtual, 44 bits physical
SIMD 256 bit = 32 byte max. SIMD vector size
Time Stamp Counter TSC is accessible via rdtsc
TSC increased at every clock cycle (non-invariant TSC)
Perf. Monitoring Performance Monitoring Counters (PMC) are not supported
Hypervisor Yes, Microsoft

Copy link
Member

@zygmuntszpak zygmuntszpak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the excellent work, and thank you very much for installing the benchmark tool as well.

src/algorithms/linear_stretching.jl Outdated Show resolved Hide resolved
src/algorithms/linear_stretching.jl Outdated Show resolved Hide resolved
src/algorithms/linear_stretching.jl Show resolved Hide resolved
@github-actions
Copy link
Contributor

Benchmark result

Judge result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmarks:
    • Target: 22 Mar 2020 - 17:58
    • Baseline: 22 Mar 2020 - 18:01
  • Package commits:
    • Target: 1f10f8
    • Baseline: 80a03f
  • Julia commits:
    • Target: 2d5741
    • Baseline: 2d5741
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 0.93 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 0.92 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 0.91 (5%) ✅ 1.00 (1%)
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 0.90 (5%) ✅ 1.00 (1%)
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 1.06 (5%) ❌ 1.00 (1%)
["Equalization", "Float32", "64×64"] 0.89 (5%) ✅ 1.00 (1%)
["Equalization", "Normed{UInt8,8}", "64×64"] 0.89 (5%) ✅ 1.00 (1%)
["GammaCorrection", "Float32", "64×64"] 1.07 (5%) ❌ 1.00 (1%)
["GammaCorrection", "Gray{Float32}", "64×64"] 1.10 (5%) ❌ 1.00 (1%)
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 0.86 (5%) ✅ 1.00 (1%)
["LinearStretching", "Float32", "64×64"] 0.20 (5%) ✅ 1.99 (1%) ❌
["LinearStretching", "Gray{Float32}", "64×64"] 0.22 (5%) ✅ 1.99 (1%) ❌
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 0.14 (5%) ✅ 4.80 (1%) ❌
["LinearStretching", "Normed{UInt8,8}", "64×64"] 0.13 (5%) ✅ 4.80 (1%) ❌
["LinearStretching", "RGB{Float32}", "64×64"] 0.45 (5%) ✅ 1.14 (1%) ❌
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 0.62 (5%) ✅ 1.21 (1%) ❌
["Matching", "Float32", "64×64"] 0.95 (5%) ✅ 1.00 (1%)
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 0.94 (5%) ✅ 1.00 (1%)
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 1.10 (5%) ❌ 1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Target

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      45658 s          0 s       1653 s      12708 s          0 s
       #2  2294 MHz      12550 s          0 s       1469 s      46844 s          0 s
       
  Memory: 6.782737731933594 GB (3515.37109375 MB free)
  Uptime: 623.0 sec
  Load Avg:  1.2021484375  1.056640625  0.65869140625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Baseline

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      61473 s          0 s       1742 s      17362 s          0 s
       #2  2294 MHz      17348 s          0 s       1601 s      62493 s          0 s
       
  Memory: 6.782737731933594 GB (3507.0 MB free)
  Uptime: 830.0 sec
  Load Avg:  1.03271484375  1.06298828125  0.75244140625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Target result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 22 Mar 2020 - 17:58
  • Package commit: 1f10f8
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 19.275 ms (5%) 2.440 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 18.608 ms (5%) 2.483 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 19.351 ms (5%) 2.935 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 21.050 ms (5%) 3.028 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 18.413 ms (5%) 2.433 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 18.014 ms (5%) 2.462 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 114.901 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 111.401 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 114.801 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 124.101 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 313.702 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 321.102 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 49.900 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 55.300 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 58.400 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 52.800 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 237.903 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 256.102 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 109.501 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 214.603 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 4.717 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 115.902 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 289.504 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 302.804 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 18.201 μs (5%) 32.25 KiB (1%) 2
["LinearStretching", "Gray{Float32}", "64×64"] 21.600 μs (5%) 32.25 KiB (1%) 2
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 11.000 μs (5%) 20.31 KiB (1%) 2
["LinearStretching", "Normed{UInt8,8}", "64×64"] 10.900 μs (5%) 20.31 KiB (1%) 2
["LinearStretching", "RGB{Float32}", "64×64"] 128.602 μs (5%) 128.61 KiB (1%) 10
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 185.503 μs (5%) 92.66 KiB (1%) 9
["Matching", "Float32", "64×64"] 288.503 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 284.102 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 276.403 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 268.502 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 726.106 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 738.407 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      45658 s          0 s       1653 s      12708 s          0 s
       #2  2294 MHz      12550 s          0 s       1469 s      46844 s          0 s
       
  Memory: 6.782737731933594 GB (3515.37109375 MB free)
  Uptime: 623.0 sec
  Load Avg:  1.2021484375  1.056640625  0.65869140625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Baseline result

Benchmark Report for /home/runner/work/ImageContrastAdjustment.jl/ImageContrastAdjustment.jl

Job Properties

  • Time of benchmark: 22 Mar 2020 - 18:1
  • Package commit: 80a03f
  • Julia commit: 2d5741
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["AdaptiveEqualization", "Float32", "64×64"] 19.315 ms (5%) 2.260 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Float32}", "64×64"] 19.983 ms (5%) 2.571 ms 73.95 MiB (1%) 67284
["AdaptiveEqualization", "Gray{Normed{UInt8,8}}", "64×64"] 20.955 ms (5%) 2.658 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "Normed{UInt8,8}", "64×64"] 20.966 ms (5%) 2.591 ms 74.08 MiB (1%) 67476
["AdaptiveEqualization", "RGB{Float32}", "64×64"] 20.239 ms (5%) 2.425 ms 74.06 MiB (1%) 67293
["AdaptiveEqualization", "RGB{Normed{UInt8,8}}", "64×64"] 20.049 ms (5%) 2.867 ms 74.03 MiB (1%) 67292
["ContrastStretching", "Float32", "64×64"] 115.000 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Float32}", "64×64"] 111.400 μs (5%) 16.17 KiB (1%) 2
["ContrastStretching", "Gray{Normed{UInt8,8}}", "64×64"] 114.800 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "Normed{UInt8,8}", "64×64"] 117.400 μs (5%) 4.23 KiB (1%) 2
["ContrastStretching", "RGB{Float32}", "64×64"] 312.202 μs (5%) 112.53 KiB (1%) 10
["ContrastStretching", "RGB{Normed{UInt8,8}}", "64×64"] 319.701 μs (5%) 76.58 KiB (1%) 9
["Equalization", "Float32", "64×64"] 56.000 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Float32}", "64×64"] 55.901 μs (5%) 25.00 KiB (1%) 7
["Equalization", "Gray{Normed{UInt8,8}}", "64×64"] 57.600 μs (5%) 15.28 KiB (1%) 9
["Equalization", "Normed{UInt8,8}", "64×64"] 59.500 μs (5%) 15.28 KiB (1%) 9
["Equalization", "RGB{Float32}", "64×64"] 235.901 μs (5%) 121.36 KiB (1%) 15
["Equalization", "RGB{Normed{UInt8,8}}", "64×64"] 262.502 μs (5%) 85.41 KiB (1%) 14
["GammaCorrection", "Float32", "64×64"] 102.300 μs (5%) 16.16 KiB (1%) 2
["GammaCorrection", "Gray{Float32}", "64×64"] 194.701 μs (5%) 136.17 KiB (1%) 7683
["GammaCorrection", "Gray{Normed{UInt8,8}}", "64×64"] 5.500 μs (5%) 4.55 KiB (1%) 2
["GammaCorrection", "Normed{UInt8,8}", "64×64"] 120.600 μs (5%) 4.22 KiB (1%) 2
["GammaCorrection", "RGB{Float32}", "64×64"] 290.802 μs (5%) 112.52 KiB (1%) 10
["GammaCorrection", "RGB{Normed{UInt8,8}}", "64×64"] 302.302 μs (5%) 76.56 KiB (1%) 9
["LinearStretching", "Float32", "64×64"] 91.900 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Float32}", "64×64"] 97.900 μs (5%) 16.17 KiB (1%) 2
["LinearStretching", "Gray{Normed{UInt8,8}}", "64×64"] 80.801 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "Normed{UInt8,8}", "64×64"] 83.400 μs (5%) 4.23 KiB (1%) 2
["LinearStretching", "RGB{Float32}", "64×64"] 285.102 μs (5%) 112.53 KiB (1%) 10
["LinearStretching", "RGB{Normed{UInt8,8}}", "64×64"] 296.902 μs (5%) 76.58 KiB (1%) 9
["Matching", "Float32", "64×64"] 304.502 μs (5%) 31.77 KiB (1%) 16
["Matching", "Gray{Float32}", "64×64"] 296.902 μs (5%) 31.80 KiB (1%) 16
["Matching", "Gray{Normed{UInt8,8}}", "64×64"] 292.801 μs (5%) 22.08 KiB (1%) 18
["Matching", "Normed{UInt8,8}", "64×64"] 267.702 μs (5%) 22.05 KiB (1%) 18
["Matching", "RGB{Float32}", "64×64"] 729.504 μs (5%) 176.47 KiB (1%) 32
["Matching", "RGB{Normed{UInt8,8}}", "64×64"] 668.804 μs (5%) 140.52 KiB (1%) 31

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["AdaptiveEqualization", "Float32"]
  • ["AdaptiveEqualization", "Gray{Float32}"]
  • ["AdaptiveEqualization", "Gray{Normed{UInt8,8}}"]
  • ["AdaptiveEqualization", "Normed{UInt8,8}"]
  • ["AdaptiveEqualization", "RGB{Float32}"]
  • ["AdaptiveEqualization", "RGB{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Float32"]
  • ["ContrastStretching", "Gray{Float32}"]
  • ["ContrastStretching", "Gray{Normed{UInt8,8}}"]
  • ["ContrastStretching", "Normed{UInt8,8}"]
  • ["ContrastStretching", "RGB{Float32}"]
  • ["ContrastStretching", "RGB{Normed{UInt8,8}}"]
  • ["Equalization", "Float32"]
  • ["Equalization", "Gray{Float32}"]
  • ["Equalization", "Gray{Normed{UInt8,8}}"]
  • ["Equalization", "Normed{UInt8,8}"]
  • ["Equalization", "RGB{Float32}"]
  • ["Equalization", "RGB{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Float32"]
  • ["GammaCorrection", "Gray{Float32}"]
  • ["GammaCorrection", "Gray{Normed{UInt8,8}}"]
  • ["GammaCorrection", "Normed{UInt8,8}"]
  • ["GammaCorrection", "RGB{Float32}"]
  • ["GammaCorrection", "RGB{Normed{UInt8,8}}"]
  • ["LinearStretching", "Float32"]
  • ["LinearStretching", "Gray{Float32}"]
  • ["LinearStretching", "Gray{Normed{UInt8,8}}"]
  • ["LinearStretching", "Normed{UInt8,8}"]
  • ["LinearStretching", "RGB{Float32}"]
  • ["LinearStretching", "RGB{Normed{UInt8,8}}"]
  • ["Matching", "Float32"]
  • ["Matching", "Gray{Float32}"]
  • ["Matching", "Gray{Normed{UInt8,8}}"]
  • ["Matching", "Normed{UInt8,8}"]
  • ["Matching", "RGB{Float32}"]
  • ["Matching", "RGB{Normed{UInt8,8}}"]

Julia versioninfo

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 18.04.4 LTS
  uname: Linux 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz: 
              speed         user         nice          sys         idle          irq
       #1  2294 MHz      61473 s          0 s       1742 s      17362 s          0 s
       #2  2294 MHz      17348 s          0 s       1601 s      62493 s          0 s
       
  Memory: 6.782737731933594 GB (3507.0 MB free)
  Uptime: 830.0 sec
  Load Avg:  1.03271484375  1.06298828125  0.75244140625
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)

Runtime information

Runtime Info
BLAS #threads 2
BLAS.vendor() openblas64
Sys.CPU_THREADS 2

lscpu output:

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  1
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               79
Model name:          Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Stepping:            1
CPU MHz:             2294.691
BogoMIPS:            4589.38
Hypervisor vendor:   Microsoft
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            51200K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt md_clear
Cpu Property Value
Brand Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
Vendor :Intel
Architecture :Broadwell
Model Family: 0x06, Model: 0x4f, Stepping: 0x01, Type: 0x00
Cores 2 physical cores, 2 logical cores (on executing CPU)
No Hyperthreading detected
Clock Frequencies Not supported by CPU
Data Cache Level 1:3 : (32, 256, 51200) kbytes
64 byte cache line size
Address Size 48 bits virtual, 44 bits physical
SIMD 256 bit = 32 byte max. SIMD vector size
Time Stamp Counter TSC is accessible via rdtsc
TSC increased at every clock cycle (non-invariant TSC)
Perf. Monitoring Performance Monitoring Counters (PMC) are not supported
Hypervisor Yes, Microsoft

although clamp before linear stretching is slightly faster, it has
boundary rounding issues, which causes test failures and isn't reliable
to use
# this is only used when user specifies custom `(src_minval, src_maxval)`
out_minval = r * img_min - o
out_maxval = r * img_max - o
do_clamp = (out_minval < dst_minval) || (out_maxval > dst_maxval)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is great as is, and is all i (at least currently) need. however, making the clamp optional would provide for maximum flexibility. would this be possible with a keyword argument, or otherwise?

thanks for all the hard work @johnnychen94

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the first two commits, it's hard to handle this correctly wrt FixedPoint, and then I totally forget about this. Sorry about that.

I've added a no_clamp option in a254af4

@johnnychen94
Copy link
Member Author

johnnychen94 commented Mar 24, 2020

I didn't expect this PR going so long, so here's a summary:

  • expose src_minval and src_maxval (fixes LinearStretching() can not do imadjustintensity(..., (minval,maxval)) #27 )
  • deprecate minval/maxval in favor of dst_minval/dst_maxval
  • introduce a new convenient API: LinearStretching((src_minval, src_maxval) => (dst_minval, dst_maxval))
  • correctly handles the clamp on output intensity
  • expose no_clamp option to disable the clamp to [dst_minval, dst_maxval]: FixedPoint inputs are still clamped wrt [typemin(T), typemax(T)] to avoid ArgumentError
  • performance tweak: 2x-20x performance boost

I plan to merge this in two days if there are no further comments

@johnnychen94 johnnychen94 merged commit 0cfa120 into master Mar 27, 2020
@johnnychen94 johnnychen94 deleted the jc/linear branch March 27, 2020 00:29
@johnnychen94
Copy link
Member Author

@zygmuntszpak @bjarthur thanks for the insightful suggestions on the API

@timholy
Copy link
Member

timholy commented Mar 31, 2020

Nice work @johnnychen94!

@bjarthur
Copy link

indeed, great work!

sorry i didn't think to suggest these earlier, but two things:

  1. it would be convenient to be able to specify a vector of length 2, in addition to a tuple, as the {src,dst}_{min,max}val . this signature would also be consistent with how the dims keyword argument on many julia functions works (e.g. mean).

  2. how about clamp=true instead of no_clamp=false? i know it might seem spurious, but it is not only three fewer letters, but avoids a double negative. the latter in particular makes me have to think a little harder to not get the sign flipped.

i can submit a PR if there is a consensus about either one or the other or both.

@johnnychen94
Copy link
Member Author

johnnychen94 commented Mar 31, 2020

Although it doesn't make a real performance difference for LinearStretching, in general, accepting vector seems like an anti-pattern to me since tuple is faster than vector. A permanent deprecation or a helpful error message(ref: JuliaLang/julia#35094) might be helpful in this case.

I'm okay to rename it to clamp, but perhaps do_clamp is more intuitive for a boolean value?

@zygmuntszpak
Copy link
Member

@bjarthur Could you please elaborate on how specifying a vector rather than a tuple is more convenient? I would prefer not to support two different ways of specifying the same thing.

do_clamp sounds odd to me since I read clamp as an action (verb) already, and so the do seems unnecessary. Hence, I would probably go with clamp. An alternative, which I anticipate people not to like because it is longer, is to have something like clamp_result = true.

@bjarthur
Copy link

bjarthur commented Apr 1, 2020

i believe in julia it is standard to accept both 2-tuples and 2-vectors when specifying the dimensions along which to perform an algebraic operation. so for example with mean:

julia> using Statistics

julia> A=rand(3,4,5);

julia> mean(A, dims=(1,3))
1×4×1 Array{Float64,3}:
[:, :, 1] =
 0.394565  0.477098  0.5762  0.563391

julia> mean(A, dims=[1,3])
1×4×1 Array{Float64,3}:
[:, :, 1] =
 0.394565  0.477098  0.5762  0.563391

similarly for quantile even:

julia> V=rand(100);

julia> quantile(V, (0.1,0.9))
(0.07442527144546038, 0.9287217120956874)

julia> quantile(V, [0.1,0.9])
2-element Array{Float64,1}:
 0.07442527144546038
 0.9287217120956874

with LinearStretching in some cases the min/max vals you want to use might be calculated and stored in a vector and it is a hassle for the user to tuple them. particularly when supporting vectors i think is as simple as adding the following method:

LinearStretching(rangemap::Pair{Vector, Vector}; no_clamp=false) =
    LinearStretching(rangemap.first..., rangemap.second..., nothing, nothing, no_clamp)

@johnnychen94
Copy link
Member Author

johnnychen94 commented Apr 2, 2020

with LinearStretching in some cases the min/max vals you want to use might be calculated and stored in a vector and it is a hassle for the user to tuple them.

That could be quite a fair use case for me. I think it's okay to get this since I believe it doesn't get things worse in this case. However, I'm not excited to add this to the codebase; I kind of prefer to distinguish tuple and vector and to not mixing them.

@zygmuntszpak
Copy link
Member

@bjarthur Perhaps you could open an issue on the Images repo regarding your suggestion of also allowing one to pass a vector instead of a tuple. If we do this here, then I would like it to become a consensus for the Images ecosystem. I want to avoid a situation where some key functions do this kind of conversion automatically, and others not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants