Skip to content

Benchmarks on first version #10

@nzy1997

Description

@nzy1997

Testing code:

@testset "solve_factoring" begin
    using Primes
    for n in 1:15
        a1 = prevprime(2^n)
        a2 = nextprime(2^n)
        @info "Testing factoring $a1 * $a2, with $(n+1) bits * $(n+1) bits"
        @time a,b = solve_factoring(n+1,n+1,a1*a2)
        @test a*b == a1*a2
    end
end

Here we use the defalut solvers. They are

BranchingStrategy(table_solver = TNContractionSolver(), selector =KNeighborSelector(1,1), measure=NumOfVertices())
reducer=NoReducer()

The results are shown below.

[ Info: Testing factoring 2 * 2, with 2 bits * 2 bits
count_num = 1
ans = true
  0.623558 seconds (79.70 k allocations: 3.809 MiB)
[ Info: Testing factoring 3 * 5, with 3 bits * 3 bits
count_num = 2
ans = true
  0.091054 seconds (206.71 k allocations: 10.165 MiB)
[ Info: Testing factoring 7 * 11, with 4 bits * 4 bits
count_num = 6
ans = true
  0.724747 seconds (456.43 k allocations: 24.993 MiB, 93.16% gc time)
[ Info: Testing factoring 13 * 17, with 5 bits * 5 bits
count_num = 2
ans = true
  0.085121 seconds (718.20 k allocations: 39.672 MiB, 10.93% gc time)
[ Info: Testing factoring 31 * 37, with 6 bits * 6 bits
count_num = 10
ans = true
  0.142455 seconds (1.27 M allocations: 86.862 MiB, 5.64% gc time)
[ Info: Testing factoring 61 * 67, with 7 bits * 7 bits
count_num = 31
ans = true
  0.327510 seconds (2.36 M allocations: 217.330 MiB, 6.20% gc time)
[ Info: Testing factoring 127 * 131, with 8 bits * 8 bits
count_num = 66
ans = true
  0.650237 seconds (4.34 M allocations: 553.691 MiB, 8.50% gc time)
[ Info: Testing factoring 251 * 257, with 9 bits * 9 bits
count_num = 2
ans = true
  0.426862 seconds (3.11 M allocations: 214.419 MiB, 4.90% gc time)
[ Info: Testing factoring 509 * 521, with 10 bits * 10 bits
count_num = 66
ans = true
  1.204698 seconds (6.92 M allocations: 1.029 GiB, 9.27% gc time)
[ Info: Testing factoring 1021 * 1031, with 11 bits * 11 bits
count_num = 385
ans = true
  9.248587 seconds (28.05 M allocations: 7.360 GiB, 33.10% gc time)
[ Info: Testing factoring 2039 * 2053, with 12 bits * 12 bits
count_num = 895
ans = true
 14.459015 seconds (63.82 M allocations: 20.254 GiB, 10.52% gc time)
[ Info: Testing factoring 4093 * 4099, with 13 bits * 13 bits
count_num = 725
ans = true
 13.827693 seconds (50.42 M allocations: 15.809 GiB, 8.99% gc time)
[ Info: Testing factoring 8191 * 8209, with 14 bits * 14 bits
count_num = 1831
ans = true
 38.311253 seconds (118.48 M allocations: 39.958 GiB, 10.57% gc time)
[ Info: Testing factoring 16381 * 16411, with 15 bits * 15 bits
count_num = 1069
ans = true
 27.754452 seconds (77.57 M allocations: 25.548 GiB, 7.12% gc time)
[ Info: Testing factoring 32749 * 32771, with 16 bits * 16 bits
count_num = 1199
ans = true
 37.600326 seconds (92.36 M allocations: 31.570 GiB, 7.54% gc time)
Test Summary:   | Pass  Total     Time
solve_factoring |   15     15  2m25.5s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions