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

New package: OptimalSortingNetworks v1.0.0 #94338

Conversation

JuliaRegistrator
Copy link
Contributor

@JuliaRegistrator JuliaRegistrator commented Oct 29, 2023

  • Registering package: OptimalSortingNetworks
  • Repository: https://gitlab.com/nsajko/OptimalSortingNetworks.jl
  • Created by: https://gitlab.com/nsajko
  • Version: v1.0.0
  • Commit: 689ffad4d222fb9ec21f16962308c90dcf1781a4
  • Git reference: HEAD
  • Description: Sort small collections efficiently and with good type inference. The sort is an
    unstable sort. The supported collections are currently tuples and vectors.

@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 29, 2023 11:53 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

Your new package pull request met all of the guidelines for auto-merging and is scheduled to be merged when the mandatory waiting period (3 days) has elapsed.

Since you are registering a new package, please make sure that you have read the package naming guidelines: https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1


If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text [noblock] in your comment. You can edit blocking comments, adding [noblock] to them in order to unblock auto-merging.

@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 82fef44 to 47758b7 Compare October 29, 2023 15:50
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 29, 2023 15:51 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 47758b7 to d2ae0b8 Compare October 29, 2023 16:04
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 29, 2023 16:04 — with GitHub Actions Inactive
@GunnarFarneback
Copy link
Contributor

[noblock]
It may be worth saying something in the README how this package compares to the SortingNetworks package.

Can you give an example where Depth is faster than Size? It doesn't seem to be the case for plain Int, at least not on my computer. I imagine Int provides about as fast compare/exchange as you'll find.

julia> using OptimalSortingNetworks: sorted, Depth, Size

julia> using Random, BenchmarkTools

julia> x = tuple(randperm(10)...);

julia> @btime sorted($x, Depth())
  6.501 ns (0 allocations: 0 bytes)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

julia> @btime sorted($x, Size())
  6.133 ns (0 allocations: 0 bytes)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from d2ae0b8 to dd0bdd0 Compare October 29, 2023 18:24
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 29, 2023 18:24 — with GitHub Actions Inactive
@nsajko
Copy link

nsajko commented Oct 29, 2023

[noblock]

You're right, Size() is faster. The advantage of a network with less depth is supposed to be more potential for exploiting parallelism, but I guess the CPU simply doesn't have the capability for that much parallelism? Or maybe the compiler is just not doing a good-enough job? Perhaps a more SIMD-aware implementation could change things... Have to correct the doc strings now.

julia> using OptimalSortingNetworks, BenchmarkTools, Random

julia> function s!(v::AbstractVector, opt)
         for i ∈ 0:(length(v) - 1)
           v[begin + i] = sorted(v[begin + i], opt)
         end
       end
s! (generic function with 1 method)

julia> const OSN = OptimalSortingNetworks
OptimalSortingNetworks

julia> const opt_d = OSN.Depth()
OptimalSortingNetworks.Depth()

julia> const opt_s = OSN.Size()
OptimalSortingNetworks.Size()

julia> tup(::Val{n}) where {n} = (randperm(n)...,)
tup (generic function with 1 method)

julia> vect(::Val{n}, len) where {n} = [tup(Val(n)) for _ ∈ 1:len]
vect (generic function with 1 method)

julia> @btime s!(v, opt_d) setup=(v=vect(Val(10), 2000);)
  14.236 μs (0 allocations: 0 bytes)

julia> @btime s!(v, opt_s) setup=(v=vect(Val(10), 2000);)
  13.936 μs (0 allocations: 0 bytes)

julia> @btime s!(v, opt_d) setup=(v=vect(Val(10), 2000);)
  14.246 μs (0 allocations: 0 bytes)

julia> @btime s!(v, opt_s) setup=(v=vect(Val(10), 2000);)
  13.966 μs (0 allocations: 0 bytes)

@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from dd0bdd0 to fd9d867 Compare October 29, 2023 21:36
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 29, 2023 21:36 — with GitHub Actions Inactive
@nsajko
Copy link

nsajko commented Oct 29, 2023

[noblock] @GunnarFarneback I tried to address your concerns with the latest changes.

@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from fd9d867 to 76ad109 Compare October 30, 2023 06:26
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 30, 2023 06:26 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 76ad109 to 22556c3 Compare October 30, 2023 07:48
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 30, 2023 07:48 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 22556c3 to 526c2fd Compare October 30, 2023 20:47
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 30, 2023 20:47 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 526c2fd to ebe3982 Compare October 30, 2023 20:49
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 30, 2023 20:49 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from ebe3982 to 3a48b7c Compare October 30, 2023 20:55
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 30, 2023 20:55 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 3a48b7c to 36f1c64 Compare October 31, 2023 16:21
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 31, 2023 16:21 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 36f1c64 to 5df0daf Compare October 31, 2023 20:28
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch October 31, 2023 20:28 — with GitHub Actions Inactive
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 5df0daf to 6dbbc44 Compare November 1, 2023 05:52
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch November 1, 2023 05:52 — with GitHub Actions Inactive
UUID: cae6f51d-d477-4615-8395-e10abcea54c6
Repo: https://gitlab.com/nsajko/OptimalSortingNetworks.jl.git
Tree: 20d6d5f88c340ba9b47a3825164f38ac6aad77c6

Registrator tree SHA: 7242ef64be5953fac9bf8b3efa3a7c4d2d44ca09
@JuliaRegistrator JuliaRegistrator force-pushed the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch from 6dbbc44 to 312ea4d Compare November 1, 2023 08:02
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch November 1, 2023 08:02 — with GitHub Actions Inactive
@JuliaTagBot JuliaTagBot merged commit 4fce310 into master Nov 1, 2023
10 checks passed
@JuliaTagBot JuliaTagBot deleted the registrator-optimalsortingnetworks-cae6f51d-v1.0.0-e216fffa88 branch November 1, 2023 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants