Binary segmentation examples

In this vignette we explore the differences in asymptotic time complexity between different implementations of binary segmentation.

Asymptotic time/memory measurement of different R expressions

The code below uses the following arguments:

  • N is a numeric vector of data sizes,
  • setup is an R expression to create the data,
  • the other arguments have names to identify them in the results, and values which are R expressions to time,
library(data.table)
#> data.table 1.14.7 IN DEVELOPMENT built 2023-02-13 18:02:32 UTC; th798 using 6 threads (see ?getDTthreads).  Latest news: r-datatable.com
atime.list <- atime::atime(
  N=2^seq(2, 20),
  setup={
    max.segs <- as.integer(N/2)
    max.changes <- max.segs-1L
    set.seed(1)
    data.vec <- 1:N
  },
  "changepoint::cpt.mean"={
    cpt.fit <- changepoint::cpt.mean(data.vec, method="BinSeg", Q=max.changes)
    sort(c(N,cpt.fit@cpts.full[max.changes,]))
  },
  "binsegRcpp::binseg_normal"={
    binseg.fit <- binsegRcpp::binseg_normal(data.vec, max.segs)
    sort(binseg.fit$splits$end)
  },
  "fpop::multiBinSeg"={
    mbs.fit <- fpop::multiBinSeg(data.vec, max.changes)
    sort(c(mbs.fit$t.est, N))
  },
  "wbs::sbs"={
    wbs.fit <- wbs::sbs(data.vec)
    split.dt <- data.table(wbs.fit$res)[order(-min.th, scale)]
    sort(split.dt[, c(N, cpt)][1:max.segs])
  },
  binsegRcpp.list={
    binseg.fit <- binsegRcpp::binseg(
      "mean_norm", data.vec, max.segs, container.str="list")
    sort(binseg.fit$splits$end)
  },
  ##seconds.limit=0.1,
  times=5)
plot(atime.list)

The default plot method creates a log-log plot of median time vs data size, for each of the specified R expressions. You can use references_best to get a tall/long data table that can be plotted to show both empirical time and memory complexity:

best.list <- atime::references_best(atime.list)
if(require(ggplot2)){
  hline.df <- with(atime.list, data.frame(seconds.limit, unit="seconds"))
  gg.both <- ggplot()+
    theme_bw()+
    facet_grid(unit ~ ., scales="free")+
    geom_hline(aes(
      yintercept=seconds.limit),
      color="grey",
      data=hline.df)+
    geom_line(aes(
      N, empirical, color=expr.name),
      data=best.list$meas)+
    geom_ribbon(aes(
      N, ymin=min, ymax=max, fill=expr.name),
      data=best.list$meas[unit=="seconds"],
      alpha=0.5)+
    scale_x_log10()+
    scale_y_log10("median line, min/max band")
  if(require(directlabels)){
    gg.both+
      directlabels::geom_dl(aes(
        N, empirical, color=expr.name, label=expr.name),
        method="right.polygons",
        data=best.list$meas)+
      theme(legend.position="none")+
      coord_cartesian(xlim=c(1,2e7))
  }else{
    gg.both
  }
}
#> Loading required package: ggplot2
#> Loading required package: directlabels
#> Warning: Transformation introduced infinite values in continuous y-axis
#> Transformation introduced infinite values in continuous y-axis

The plots above show some speed differences between binary segmentation algorithms, but they could be even easier to see for larger data sizes (exercise for the reader: try modifying the N and seconds.limit arguments). You can also see that memory usage is much larger for changepoint than for the other packages.

Closest asymptotic references

You can use code like below to compute asymptotic references which are best fit for each expression. We do the best fit by adjusting each reference to the largest N, and then ranking each reference by distance to the measurement of the second to largest N. The code below uses each.sign.rank==1 to compute the closest reference above and below,

best.refs <- best.list$ref[each.sign.rank==1]
(time.refs <- best.refs[unit=="seconds"])
#>        unit                 expr.name   fun.latex  fun.name     N empirical
#>      <char>                    <char>      <char>    <char> <num>     <num>
#>  1: seconds     changepoint::cpt.mean N^2 \\log N N^2 log N    64 0.0006755
#>  2: seconds     changepoint::cpt.mean N^2 \\log N N^2 log N   128 0.0011141
#>  3: seconds     changepoint::cpt.mean N^2 \\log N N^2 log N   256 0.0028249
#>  4: seconds     changepoint::cpt.mean N^2 \\log N N^2 log N   512 0.0096711
#>  5: seconds     changepoint::cpt.mean N^2 \\log N N^2 log N  1024 0.0436961
#>  6: seconds     changepoint::cpt.mean         N^3       N^3   128 0.0011141
#>  7: seconds     changepoint::cpt.mean         N^3       N^3   256 0.0028249
#>  8: seconds     changepoint::cpt.mean         N^3       N^3   512 0.0096711
#>  9: seconds     changepoint::cpt.mean         N^3       N^3  1024 0.0436961
#> 10: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N     4 0.0012846
#> 11: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N     8 0.0011558
#> 12: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N    16 0.0012287
#> 13: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N    32 0.0012794
#> 14: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N    64 0.0012672
#> 15: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N   128 0.0012465
#> 16: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N   256 0.0018765
#> 17: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N   512 0.0013985
#> 18: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N  1024 0.0016516
#> 19: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N  2048 0.0021549
#> 20: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N  4096 0.0040744
#> 21: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N  8192 0.0068021
#> 22: seconds binsegRcpp::binseg_normal    \\sqrt N    sqrt N 16384 0.0113969
#> 23: seconds binsegRcpp::binseg_normal           N         N   128 0.0012465
#> 24: seconds binsegRcpp::binseg_normal           N         N   256 0.0018765
#> 25: seconds binsegRcpp::binseg_normal           N         N   512 0.0013985
#> 26: seconds binsegRcpp::binseg_normal           N         N  1024 0.0016516
#> 27: seconds binsegRcpp::binseg_normal           N         N  2048 0.0021549
#> 28: seconds binsegRcpp::binseg_normal           N         N  4096 0.0040744
#> 29: seconds binsegRcpp::binseg_normal           N         N  8192 0.0068021
#> 30: seconds binsegRcpp::binseg_normal           N         N 16384 0.0113969
#> 31: seconds         fpop::multiBinSeg           N         N   128 0.0001117
#> 32: seconds         fpop::multiBinSeg           N         N   256 0.0001467
#> 33: seconds         fpop::multiBinSeg           N         N   512 0.0002458
#> 34: seconds         fpop::multiBinSeg           N         N  1024 0.0004558
#> 35: seconds         fpop::multiBinSeg           N         N  2048 0.0008718
#> 36: seconds         fpop::multiBinSeg           N         N  4096 0.0018091
#> 37: seconds         fpop::multiBinSeg           N         N  8192 0.0036655
#> 38: seconds         fpop::multiBinSeg           N         N 16384 0.0074866
#> 39: seconds         fpop::multiBinSeg           N         N 32768 0.0152995
#> 40: seconds         fpop::multiBinSeg   N \\log N   N log N   256 0.0001467
#> 41: seconds         fpop::multiBinSeg   N \\log N   N log N   512 0.0002458
#> 42: seconds         fpop::multiBinSeg   N \\log N   N log N  1024 0.0004558
#> 43: seconds         fpop::multiBinSeg   N \\log N   N log N  2048 0.0008718
#> 44: seconds         fpop::multiBinSeg   N \\log N   N log N  4096 0.0018091
#> 45: seconds         fpop::multiBinSeg   N \\log N   N log N  8192 0.0036655
#> 46: seconds         fpop::multiBinSeg   N \\log N   N log N 16384 0.0074866
#> 47: seconds         fpop::multiBinSeg   N \\log N   N log N 32768 0.0152995
#> 48: seconds                  wbs::sbs    \\sqrt N    sqrt N     4 0.0010094
#> 49: seconds                  wbs::sbs    \\sqrt N    sqrt N     8 0.0010933
#> 50: seconds                  wbs::sbs    \\sqrt N    sqrt N    16 0.0010031
#> 51: seconds                  wbs::sbs    \\sqrt N    sqrt N    32 0.0010139
#> 52: seconds                  wbs::sbs    \\sqrt N    sqrt N    64 0.0010071
#> 53: seconds                  wbs::sbs    \\sqrt N    sqrt N   128 0.0010477
#> 54: seconds                  wbs::sbs    \\sqrt N    sqrt N   256 0.0012708
#> 55: seconds                  wbs::sbs    \\sqrt N    sqrt N   512 0.0010484
#> 56: seconds                  wbs::sbs    \\sqrt N    sqrt N  1024 0.0012803
#> 57: seconds                  wbs::sbs    \\sqrt N    sqrt N  2048 0.0020995
#> 58: seconds                  wbs::sbs    \\sqrt N    sqrt N  4096 0.0035231
#> 59: seconds                  wbs::sbs    \\sqrt N    sqrt N  8192 0.0054013
#> 60: seconds                  wbs::sbs    \\sqrt N    sqrt N 16384 0.0087495
#> 61: seconds                  wbs::sbs    \\sqrt N    sqrt N 32768 0.0147431
#> 62: seconds                  wbs::sbs           N         N   128 0.0010477
#> 63: seconds                  wbs::sbs           N         N   256 0.0012708
#> 64: seconds                  wbs::sbs           N         N   512 0.0010484
#> 65: seconds                  wbs::sbs           N         N  1024 0.0012803
#> 66: seconds                  wbs::sbs           N         N  2048 0.0020995
#> 67: seconds                  wbs::sbs           N         N  4096 0.0035231
#> 68: seconds                  wbs::sbs           N         N  8192 0.0054013
#> 69: seconds                  wbs::sbs           N         N 16384 0.0087495
#> 70: seconds                  wbs::sbs           N         N 32768 0.0147431
#> 71: seconds           binsegRcpp.list   N \\log N   N log N    64 0.0012315
#> 72: seconds           binsegRcpp.list   N \\log N   N log N   128 0.0012837
#> 73: seconds           binsegRcpp.list   N \\log N   N log N   256 0.0015373
#> 74: seconds           binsegRcpp.list   N \\log N   N log N   512 0.0014690
#> 75: seconds           binsegRcpp.list   N \\log N   N log N  1024 0.0020217
#> 76: seconds           binsegRcpp.list   N \\log N   N log N  2048 0.0038123
#> 77: seconds           binsegRcpp.list   N \\log N   N log N  4096 0.0127071
#> 78: seconds           binsegRcpp.list         N^2       N^2   512 0.0014690
#> 79: seconds           binsegRcpp.list         N^2       N^2  1024 0.0020217
#> 80: seconds           binsegRcpp.list         N^2       N^2  2048 0.0038123
#> 81: seconds           binsegRcpp.list         N^2       N^2  4096 0.0127071
#>        unit                 expr.name   fun.latex  fun.name     N empirical
#>        reference  rank   i.N i.empirical i.reference i.rank         dist  sign
#>            <num> <num> <num>       <num>       <num>  <num>        <num> <num>
#>  1: 1.024127e-04     5   512   0.0096711 0.009831623      2 -0.007149321    -1
#>  2: 4.779261e-04     4   512   0.0096711 0.009831623      2 -0.007149321    -1
#>  3: 2.184805e-03     3   512   0.0096711 0.009831623      2 -0.007149321    -1
#>  4: 9.831623e-03     2   512   0.0096711 0.009831623      2 -0.007149321    -1
#>  5: 4.369610e-02     1   512   0.0096711 0.009831623      2 -0.007149321    -1
#>  6: 8.534395e-05     4   512   0.0096711 0.005462013      2  0.248123184     1
#>  7: 6.827516e-04     3   512   0.0096711 0.005462013      2  0.248123184     1
#>  8: 5.462013e-03     2   512   0.0096711 0.005462013      2  0.248123184     1
#>  9: 4.369610e-02     1   512   0.0096711 0.005462013      2  0.248123184     1
#> 10: 1.780766e-04    13  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 11: 2.518383e-04    12  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 12: 3.561531e-04    11  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 13: 5.036766e-04    10  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 14: 7.123062e-04     9  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 15: 1.007353e-03     8  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 16: 1.424612e-03     7  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 17: 2.014706e-03     6  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 18: 2.849225e-03     5  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 19: 4.029413e-03     4  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 20: 5.698450e-03     3  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 21: 8.058825e-03     2  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 22: 1.139690e-02     1  8192   0.0068021 0.008058825      2 -0.073628727    -1
#> 23: 8.903828e-05     8  8192   0.0068021 0.005698450      2  0.076886270     1
#> 24: 1.780766e-04     7  8192   0.0068021 0.005698450      2  0.076886270     1
#> 25: 3.561531e-04     6  8192   0.0068021 0.005698450      2  0.076886270     1
#> 26: 7.123062e-04     5  8192   0.0068021 0.005698450      2  0.076886270     1
#> 27: 1.424612e-03     4  8192   0.0068021 0.005698450      2  0.076886270     1
#> 28: 2.849225e-03     3  8192   0.0068021 0.005698450      2  0.076886270     1
#> 29: 5.698450e-03     2  8192   0.0068021 0.005698450      2  0.076886270     1
#> 30: 1.139690e-02     1  8192   0.0068021 0.005698450      2  0.076886270     1
#> 31: 5.976367e-05     9 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 32: 1.195273e-04     8 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 33: 2.390547e-04     7 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 34: 4.781094e-04     6 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 35: 9.562187e-04     5 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 36: 1.912437e-03     4 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 37: 3.824875e-03     3 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 38: 7.649750e-03     2 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 39: 1.529950e-02     1 16384   0.0074866 0.007649750      2 -0.009362612    -1
#> 40: 6.374792e-05     8 16384   0.0074866 0.007139767      2  0.020600611     1
#> 41: 1.434328e-04     7 16384   0.0074866 0.007139767      2  0.020600611     1
#> 42: 3.187396e-04     6 16384   0.0074866 0.007139767      2  0.020600611     1
#> 43: 7.012271e-04     5 16384   0.0074866 0.007139767      2  0.020600611     1
#> 44: 1.529950e-03     4 16384   0.0074866 0.007139767      2  0.020600611     1
#> 45: 3.314892e-03     3 16384   0.0074866 0.007139767      2  0.020600611     1
#> 46: 7.139767e-03     2 16384   0.0074866 0.007139767      2  0.020600611     1
#> 47: 1.529950e-02     1 16384   0.0074866 0.007139767      2  0.020600611     1
#> 48: 1.628898e-04    14 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 49: 2.303609e-04    13 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 50: 3.257796e-04    12 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 51: 4.607219e-04    11 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 52: 6.515591e-04    10 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 53: 9.214438e-04     9 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 54: 1.303118e-03     8 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 55: 1.842888e-03     7 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 56: 2.606236e-03     6 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 57: 3.685775e-03     5 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 58: 5.212473e-03     4 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 59: 7.371550e-03     3 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 60: 1.042495e-02     2 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 61: 1.474310e-02     1 16384   0.0087495 0.010424946      2 -0.076090578    -1
#> 62: 5.759023e-05     9 16384   0.0087495 0.007371550      2  0.074424420     1
#> 63: 1.151805e-04     8 16384   0.0087495 0.007371550      2  0.074424420     1
#> 64: 2.303609e-04     7 16384   0.0087495 0.007371550      2  0.074424420     1
#> 65: 4.607219e-04     6 16384   0.0087495 0.007371550      2  0.074424420     1
#> 66: 9.214438e-04     5 16384   0.0087495 0.007371550      2  0.074424420     1
#> 67: 1.842888e-03     4 16384   0.0087495 0.007371550      2  0.074424420     1
#> 68: 3.685775e-03     3 16384   0.0087495 0.007371550      2  0.074424420     1
#> 69: 7.371550e-03     2 16384   0.0087495 0.007371550      2  0.074424420     1
#> 70: 1.474310e-02     1 16384   0.0087495 0.007371550      2  0.074424420     1
#> 71: 9.927422e-05     7  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 72: 2.316398e-04     6  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 73: 5.294625e-04     5  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 74: 1.191291e-03     4  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 75: 2.647313e-03     3  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 76: 5.824088e-03     2  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 77: 1.270710e-02     1  2048   0.0038123 0.005824088      2 -0.184040822    -1
#> 78: 1.985484e-04     4  2048   0.0038123 0.003176775      2  0.079200613     1
#> 79: 7.941938e-04     3  2048   0.0038123 0.003176775      2  0.079200613     1
#> 80: 3.176775e-03     2  2048   0.0038123 0.003176775      2  0.079200613     1
#> 81: 1.270710e-02     1  2048   0.0038123 0.003176775      2  0.079200613     1
#>        reference  rank   i.N i.empirical i.reference i.rank         dist  sign
#>     overall.rank each.sign.rank
#>            <num>          <num>
#>  1:            1              1
#>  2:            1              1
#>  3:            1              1
#>  4:            1              1
#>  5:            1              1
#>  6:            3              1
#>  7:            3              1
#>  8:            3              1
#>  9:            3              1
#> 10:            1              1
#> 11:            1              1
#> 12:            1              1
#> 13:            1              1
#> 14:            1              1
#> 15:            1              1
#> 16:            1              1
#> 17:            1              1
#> 18:            1              1
#> 19:            1              1
#> 20:            1              1
#> 21:            1              1
#> 22:            1              1
#> 23:            2              1
#> 24:            2              1
#> 25:            2              1
#> 26:            2              1
#> 27:            2              1
#> 28:            2              1
#> 29:            2              1
#> 30:            2              1
#> 31:            1              1
#> 32:            1              1
#> 33:            1              1
#> 34:            1              1
#> 35:            1              1
#> 36:            1              1
#> 37:            1              1
#> 38:            1              1
#> 39:            1              1
#> 40:            2              1
#> 41:            2              1
#> 42:            2              1
#> 43:            2              1
#> 44:            2              1
#> 45:            2              1
#> 46:            2              1
#> 47:            2              1
#> 48:            2              1
#> 49:            2              1
#> 50:            2              1
#> 51:            2              1
#> 52:            2              1
#> 53:            2              1
#> 54:            2              1
#> 55:            2              1
#> 56:            2              1
#> 57:            2              1
#> 58:            2              1
#> 59:            2              1
#> 60:            2              1
#> 61:            2              1
#> 62:            1              1
#> 63:            1              1
#> 64:            1              1
#> 65:            1              1
#> 66:            1              1
#> 67:            1              1
#> 68:            1              1
#> 69:            1              1
#> 70:            1              1
#> 71:            3              1
#> 72:            3              1
#> 73:            3              1
#> 74:            3              1
#> 75:            3              1
#> 76:            3              1
#> 77:            3              1
#> 78:            1              1
#> 79:            1              1
#> 80:            1              1
#> 81:            1              1
#>     overall.rank each.sign.rank

Then you can plot these references with the empirical data using the ggplot code below,

ref.color <- "red"
## try() to avoid CRAN error 'from' must be a finite number, on
## Flavors: r-devel-linux-x86_64-debian-gcc, r-release-linux-x86_64,
## due to https://github.com/r-lib/scales/issues/307
(seconds.dt <- best.list$meas[unit=="seconds"])
#>        unit     N                 expr.name       min    median     itr/sec
#>      <char> <num>                    <char>     <num>     <num>       <num>
#>  1: seconds     4     changepoint::cpt.mean 0.0003476 0.0003563  2654.10391
#>  2: seconds     8     changepoint::cpt.mean 0.0003867 0.0003956  2350.06580
#>  3: seconds    16     changepoint::cpt.mean 0.0004451 0.0004558  1985.15107
#>  4: seconds    32     changepoint::cpt.mean 0.0005034 0.0005151  1833.71841
#>  5: seconds    64     changepoint::cpt.mean 0.0006517 0.0006755  1433.03431
#>  6: seconds   128     changepoint::cpt.mean 0.0010660 0.0011141   886.71349
#>  7: seconds   256     changepoint::cpt.mean 0.0025735 0.0028249   358.81390
#>  8: seconds   512     changepoint::cpt.mean 0.0095972 0.0096711   102.93806
#>  9: seconds  1024     changepoint::cpt.mean 0.0429154 0.0436961    22.93770
#> 10: seconds     4 binsegRcpp::binseg_normal 0.0012534 0.0012846   739.61762
#> 11: seconds     8 binsegRcpp::binseg_normal 0.0011482 0.0011558   836.21829
#> 12: seconds    16 binsegRcpp::binseg_normal 0.0011634 0.0012287   778.69491
#> 13: seconds    32 binsegRcpp::binseg_normal 0.0012197 0.0012794   763.53363
#> 14: seconds    64 binsegRcpp::binseg_normal 0.0011792 0.0012672   781.94642
#> 15: seconds   128 binsegRcpp::binseg_normal 0.0012064 0.0012465   781.65304
#> 16: seconds   256 binsegRcpp::binseg_normal 0.0016224 0.0018765   506.53942
#> 17: seconds   512 binsegRcpp::binseg_normal 0.0013395 0.0013985   688.46816
#> 18: seconds  1024 binsegRcpp::binseg_normal 0.0015899 0.0016516   577.81424
#> 19: seconds  2048 binsegRcpp::binseg_normal 0.0019784 0.0021549   478.53186
#> 20: seconds  4096 binsegRcpp::binseg_normal 0.0038595 0.0040744   242.54184
#> 21: seconds  8192 binsegRcpp::binseg_normal 0.0066678 0.0068021   145.40326
#> 22: seconds 16384 binsegRcpp::binseg_normal 0.0109927 0.0113969    88.92426
#> 23: seconds     4         fpop::multiBinSeg 0.0000509 0.0000555 15898.25119
#> 24: seconds     8         fpop::multiBinSeg 0.0000486 0.0000531 17367.14137
#> 25: seconds    16         fpop::multiBinSeg 0.0000544 0.0000816 11241.00719
#> 26: seconds    32         fpop::multiBinSeg 0.0000795 0.0000862 10761.94576
#> 27: seconds    64         fpop::multiBinSeg 0.0000699 0.0000776 12207.03125
#> 28: seconds   128         fpop::multiBinSeg 0.0000937 0.0001117  8620.68966
#> 29: seconds   256         fpop::multiBinSeg 0.0001427 0.0001467  6435.83473
#> 30: seconds   512         fpop::multiBinSeg 0.0002417 0.0002458  3946.95295
#> 31: seconds  1024         fpop::multiBinSeg 0.0004433 0.0004558  2097.75540
#> 32: seconds  2048         fpop::multiBinSeg 0.0008672 0.0008718  1131.65697
#> 33: seconds  4096         fpop::multiBinSeg 0.0017748 0.0018091   541.95255
#> 34: seconds  8192         fpop::multiBinSeg 0.0036165 0.0036655   272.06442
#> 35: seconds 16384         fpop::multiBinSeg 0.0074416 0.0074866   132.73585
#> 36: seconds 32768         fpop::multiBinSeg 0.0152219 0.0152995    65.03422
#> 37: seconds     4                  wbs::sbs 0.0009283 0.0010094   982.87826
#> 38: seconds     8                  wbs::sbs 0.0009694 0.0010933   944.15333
#> 39: seconds    16                  wbs::sbs 0.0009511 0.0010031   916.55668
#> 40: seconds    32                  wbs::sbs 0.0009364 0.0010139   958.99344
#> 41: seconds    64                  wbs::sbs 0.0009599 0.0010071   988.06418
#> 42: seconds   128                  wbs::sbs 0.0010133 0.0010477   933.22757
#> 43: seconds   256                  wbs::sbs 0.0011485 0.0012708   718.91760
#> 44: seconds   512                  wbs::sbs 0.0010371 0.0010484   901.53441
#> 45: seconds  1024                  wbs::sbs 0.0012428 0.0012803   759.32450
#> 46: seconds  2048                  wbs::sbs 0.0019554 0.0020995   443.65179
#> 47: seconds  4096                  wbs::sbs 0.0030335 0.0035231   276.39885
#> 48: seconds  8192                  wbs::sbs 0.0052003 0.0054013   184.19191
#> 49: seconds 16384                  wbs::sbs 0.0084903 0.0087495   115.84085
#> 50: seconds 32768                  wbs::sbs 0.0144518 0.0147431    67.80615
#> 51: seconds     4           binsegRcpp.list 0.0011538 0.0011769   826.43262
#> 52: seconds     8           binsegRcpp.list 0.0011592 0.0012748   774.49735
#> 53: seconds    16           binsegRcpp.list 0.0011695 0.0012208   800.90983
#> 54: seconds    32           binsegRcpp.list 0.0011742 0.0012015   806.55568
#> 55: seconds    64           binsegRcpp.list 0.0011871 0.0012315   807.36315
#> 56: seconds   128           binsegRcpp.list 0.0012533 0.0012837   722.14680
#> 57: seconds   256           binsegRcpp.list 0.0013364 0.0015373   659.89178
#> 58: seconds   512           binsegRcpp.list 0.0013894 0.0014690   666.34682
#> 59: seconds  1024           binsegRcpp.list 0.0020038 0.0020217   485.80478
#> 60: seconds  2048           binsegRcpp.list 0.0035570 0.0038123   266.28889
#> 61: seconds  4096           binsegRcpp.list 0.0118445 0.0127071    79.45589
#>        unit     N                 expr.name       min    median     itr/sec
#>          gc/sec n_itr  n_gc result             memory
#>           <num> <int> <num> <list>             <list>
#>  1: 1990.577931     4     3        <Rprofmem[4851x3]>
#>  2:    0.000000     5     0           <Rprofmem[3x3]>
#>  3:    0.000000     5     0          <Rprofmem[11x3]>
#>  4:    0.000000     5     0          <Rprofmem[16x3]>
#>  5:    0.000000     5     0          <Rprofmem[86x3]>
#>  6:    0.000000     5     0         <Rprofmem[215x3]>
#>  7:    0.000000     5     0         <Rprofmem[435x3]>
#>  8:    0.000000     5     0         <Rprofmem[845x3]>
#>  9:    5.734425     4     1        <Rprofmem[1640x3]>
#> 10:  184.904404     4     1        <Rprofmem[1887x3]>
#> 11:    0.000000     5     0          <Rprofmem[11x3]>
#> 12:    0.000000     5     0          <Rprofmem[13x3]>
#> 13:  190.883408     4     1          <Rprofmem[24x3]>
#> 14:    0.000000     5     0          <Rprofmem[76x3]>
#> 15:    0.000000     5     0         <Rprofmem[131x3]>
#> 16:    0.000000     5     0         <Rprofmem[131x3]>
#> 17:    0.000000     5     0         <Rprofmem[131x3]>
#> 18:    0.000000     5     0         <Rprofmem[131x3]>
#> 19:  119.632966     4     1         <Rprofmem[131x3]>
#> 20:    0.000000     5     0         <Rprofmem[131x3]>
#> 21:   36.350814     4     1         <Rprofmem[131x3]>
#> 22:   22.231065     4     1         <Rprofmem[164x3]>
#> 23:    0.000000     5     0          <Rprofmem[34x3]>
#> 24:    0.000000     5     0           <Rprofmem[0x3]>
#> 25:    0.000000     5     0           <Rprofmem[0x3]>
#> 26:    0.000000     5     0           <Rprofmem[2x3]>
#> 27:    0.000000     5     0           <Rprofmem[6x3]>
#> 28:    0.000000     5     0           <Rprofmem[9x3]>
#> 29:    0.000000     5     0           <Rprofmem[9x3]>
#> 30:    0.000000     5     0           <Rprofmem[9x3]>
#> 31:    0.000000     5     0           <Rprofmem[9x3]>
#> 32:    0.000000     5     0           <Rprofmem[9x3]>
#> 33:    0.000000     5     0           <Rprofmem[9x3]>
#> 34:    0.000000     5     0           <Rprofmem[9x3]>
#> 35:    0.000000     5     0           <Rprofmem[9x3]>
#> 36:    0.000000     5     0           <Rprofmem[9x3]>
#> 37:    0.000000     5     0         <Rprofmem[198x3]>
#> 38:  236.038333     4     1          <Rprofmem[16x3]>
#> 39:    0.000000     5     0          <Rprofmem[15x3]>
#> 40:    0.000000     5     0          <Rprofmem[38x3]>
#> 41:    0.000000     5     0          <Rprofmem[47x3]>
#> 42:  233.306892     4     1          <Rprofmem[49x3]>
#> 43:    0.000000     5     0          <Rprofmem[49x3]>
#> 44:    0.000000     5     0          <Rprofmem[49x3]>
#> 45:    0.000000     5     0          <Rprofmem[49x3]>
#> 46:    0.000000     5     0          <Rprofmem[49x3]>
#> 47:    0.000000     5     0          <Rprofmem[49x3]>
#> 48:    0.000000     5     0          <Rprofmem[49x3]>
#> 49:   77.227233     3     2          <Rprofmem[49x3]>
#> 50:   16.951537     4     1          <Rprofmem[49x3]>
#> 51:    0.000000     5     0          <Rprofmem[11x3]>
#> 52:    0.000000     5     0          <Rprofmem[11x3]>
#> 53:    0.000000     5     0          <Rprofmem[14x3]>
#> 54:    0.000000     5     0          <Rprofmem[24x3]>
#> 55:  201.840788     4     1          <Rprofmem[74x3]>
#> 56:    0.000000     5     0         <Rprofmem[131x3]>
#> 57:  164.972944     4     1         <Rprofmem[131x3]>
#> 58:    0.000000     5     0         <Rprofmem[131x3]>
#> 59:    0.000000     5     0         <Rprofmem[131x3]>
#> 60:    0.000000     5     0         <Rprofmem[131x3]>
#> 61:   19.863972     4     1         <Rprofmem[131x3]>
#>          gc/sec n_itr  n_gc result             memory
#>                                            time            gc    kilobytes
#>                                          <list>        <list>        <num>
#>  1:               126ms,452µs,356µs,351µs,348µs <tbl_df[5x3]> 8.463555e+03
#>  2:               535µs,423µs,387µs,396µs,387µs <tbl_df[5x3]> 7.734375e-01
#>  3:               652µs,516µs,456µs,450µs,445µs <tbl_df[5x3]> 3.523438e+00
#>  4:               668µs,533µs,515µs,507µs,503µs <tbl_df[5x3]> 1.075000e+01
#>  5:               810µs,692µs,660µs,676µs,652µs <tbl_df[5x3]> 5.143750e+01
#>  6:          1.24ms,1.11ms,1.08ms,1.07ms,1.14ms <tbl_df[5x3]> 1.914219e+02
#>  7:           2.7ms,2.57ms,2.83ms,2.91ms,2.93ms <tbl_df[5x3]> 6.972109e+02
#>  8:            9.9ms,9.76ms,9.67ms,9.64ms,9.6ms <tbl_df[5x3]> 2.619789e+03
#>  9:          42.9ms,43.6ms,43.7ms,48.2ms,44.2ms <tbl_df[5x3]> 1.011460e+04
#> 10:           4.39ms,1.28ms,1.6ms,1.27ms,1.25ms <tbl_df[5x3]> 5.021289e+03
#> 11:          1.34ms,1.19ms,1.15ms,1.16ms,1.15ms <tbl_df[5x3]> 7.000781e+01
#> 12:          1.56ms,1.29ms,1.18ms,1.16ms,1.23ms <tbl_df[5x3]> 7.018750e+01
#> 13:           4.25ms,1.28ms,1.5ms,1.24ms,1.22ms <tbl_df[5x3]> 7.282031e+01
#> 14:           1.46ms,1.27ms,1.29ms,1.18ms,1.2ms <tbl_df[5x3]> 8.872656e+01
#> 15:          1.46ms,1.25ms,1.24ms,1.25ms,1.21ms <tbl_df[5x3]> 1.212734e+02
#> 16:           2.3ms,1.88ms,1.84ms,1.62ms,2.23ms <tbl_df[5x3]> 1.667734e+02
#> 17:           1.72ms,1.4ms,1.36ms,1.45ms,1.34ms <tbl_df[5x3]> 2.577734e+02
#> 18:             2ms,1.78ms,1.62ms,1.59ms,1.65ms <tbl_df[5x3]> 4.397734e+02
#> 19:          5.26ms,2.16ms,1.98ms,2.15ms,2.06ms <tbl_df[5x3]> 8.037734e+02
#> 20:          4.38ms,4.07ms,3.86ms,3.89ms,4.42ms <tbl_df[5x3]> 1.531773e+03
#> 21:       7.32ms, 6.8ms, 6.72ms,11.37ms, 6.67ms <tbl_df[5x3]> 2.987773e+03
#> 22:            11.4ms,11.4ms,16.2ms,11ms,11.2ms <tbl_df[5x3]> 5.907766e+03
#> 23:          82.1µs,72.8µs,55.5µs,53.2µs,50.9µs <tbl_df[5x3]> 3.199219e+01
#> 24:          74.5µs,60.8µs,53.1µs,50.9µs,48.6µs <tbl_df[5x3]> 0.000000e+00
#> 25:      96.1µs,152.4µs, 81.6µs, 60.3µs, 54.4µs <tbl_df[5x3]> 0.000000e+00
#> 26:     119.5µs, 97.1µs, 86.2µs, 82.3µs, 79.5µs <tbl_df[5x3]> 5.937500e-01
#> 27:     102.5µs, 85.7µs, 77.6µs, 73.9µs, 69.9µs <tbl_df[5x3]> 2.265625e+00
#> 28:     126.8µs,111.7µs,150.3µs, 97.5µs, 93.7µs <tbl_df[5x3]> 5.156250e+00
#> 29:               187µs,157µs,147µs,144µs,143µs <tbl_df[5x3]> 9.906250e+00
#> 30:               276µs,260µs,246µs,243µs,242µs <tbl_df[5x3]> 1.940625e+01
#> 31:               582µs,458µs,456µs,443µs,444µs <tbl_df[5x3]> 3.840625e+01
#> 32:               924µs,884µs,871µs,872µs,867µs <tbl_df[5x3]> 7.640625e+01
#> 33:          1.99ms,1.85ms,1.81ms,1.81ms,1.77ms <tbl_df[5x3]> 1.524063e+02
#> 34:          3.78ms,3.67ms,3.62ms,3.68ms,3.63ms <tbl_df[5x3]> 3.044063e+02
#> 35:          7.76ms,7.44ms,7.44ms,7.54ms,7.49ms <tbl_df[5x3]> 6.084063e+02
#> 36:          15.7ms,15.2ms,15.3ms,15.3ms,15.3ms <tbl_df[5x3]> 1.216406e+03
#> 37:     1.2ms,  1.02ms,  1.01ms,928.3µs,928.6µs <tbl_df[5x3]> 3.070859e+02
#> 38:   4.06ms,  1.03ms,969.4µs,  1.15ms,  1.09ms <tbl_df[5x3]> 8.298438e+01
#> 39:       1.16ms,  1ms,  1.39ms,952.1µs,951.1µs <tbl_df[5x3]> 8.373438e+01
#> 40:    1.21ms,  1.12ms,  1.01ms,936.4µs,938.9µs <tbl_df[5x3]> 9.267188e+01
#> 41:    1.11ms,  1.01ms,959.9µs,973.2µs,  1.01ms <tbl_df[5x3]> 1.055938e+02
#> 42:          1.21ms,1.01ms,4.12ms,1.02ms,1.05ms <tbl_df[5x3]> 1.289375e+02
#> 43:           1.64ms,1.7ms,1.27ms,1.19ms,1.15ms <tbl_df[5x3]> 1.749375e+02
#> 44:          1.24ms,1.18ms,1.05ms,1.04ms,1.04ms <tbl_df[5x3]> 2.669375e+02
#> 45:          1.48ms,1.28ms,1.25ms,1.34ms,1.24ms <tbl_df[5x3]> 4.509375e+02
#> 46:           3.05ms,2.17ms,2.1ms,1.99ms,1.96ms <tbl_df[5x3]> 8.189375e+02
#> 47:          4.81ms,3.62ms,3.11ms,3.03ms,3.52ms <tbl_df[5x3]> 1.554938e+03
#> 48:            5.71ms,5.36ms,5.4ms,5.2ms,5.48ms <tbl_df[5x3]> 3.026938e+03
#> 49:     12.71ms, 8.49ms,12.16ms, 8.75ms, 8.66ms <tbl_df[5x3]> 5.970938e+03
#> 50:          15.1ms,14.7ms,20.6ms,14.5ms,14.7ms <tbl_df[5x3]> 1.185894e+04
#> 51:          1.34ms,1.18ms,1.15ms,1.22ms,1.16ms <tbl_df[5x3]> 7.000781e+01
#> 52:          1.53ms,1.27ms,1.27ms,1.22ms,1.16ms <tbl_df[5x3]> 7.000781e+01
#> 53:          1.42ms,1.26ms,1.22ms,1.17ms,1.18ms <tbl_df[5x3]> 7.018750e+01
#> 54:           1.41ms,1.2ms,1.17ms,1.18ms,1.24ms <tbl_df[5x3]> 7.282031e+01
#> 55:          1.31ms,1.23ms,1.19ms,4.04ms,1.23ms <tbl_df[5x3]> 8.872656e+01
#> 56:          1.82ms,1.31ms,1.28ms,1.26ms,1.25ms <tbl_df[5x3]> 1.212734e+02
#> 57:           1.54ms,1.37ms,1.34ms,4.5ms,1.81ms <tbl_df[5x3]> 1.667734e+02
#> 58:            1.65ms,1.6ms,1.4ms,1.39ms,1.47ms <tbl_df[5x3]> 2.577734e+02
#> 59:             2.08ms,2.17ms,2.02ms,2.02ms,2ms <tbl_df[5x3]> 4.397734e+02
#> 60:          3.82ms,3.56ms,3.75ms,3.84ms,3.81ms <tbl_df[5x3]> 8.037734e+02
#> 61:          13.7ms,12.7ms,17.4ms,12.1ms,11.8ms <tbl_df[5x3]> 1.531773e+03
#>                                            time            gc    kilobytes
#>           q25       q75       max       mean           sd  fun.name   fun.latex
#>         <num>     <num>     <num>      <num>        <num>    <char>      <char>
#>  1: 0.0003513 0.0004519 0.1264509 0.02559160 5.638208e-02 N^2 log N N^2 \\log N
#>  2: 0.0003874 0.0004231 0.0005348 0.00042552 6.285560e-05 N^2 log N N^2 \\log N
#>  3: 0.0004496 0.0005160 0.0006522 0.00050374 8.783324e-05 N^2 log N N^2 \\log N
#>  4: 0.0005068 0.0005329 0.0006685 0.00054534 6.978877e-05 N^2 log N N^2 \\log N
#>  5: 0.0006604 0.0006919 0.0008096 0.00069782 6.433372e-05 N^2 log N N^2 \\log N
#>  6: 0.0010845 0.0011385 0.0012357 0.00112776 6.640541e-05 N^2 log N N^2 \\log N
#>  7: 0.0026959 0.0029094 0.0029311 0.00278696 1.508844e-04 N^2 log N N^2 \\log N
#>  8: 0.0096422 0.0097641 0.0098983 0.00971458 1.194913e-04 N^2 log N N^2 \\log N
#>  9: 0.0436067 0.0441672 0.0481760 0.04451228 2.096317e-03 N^2 log N N^2 \\log N
#> 10: 0.0012711 0.0015991 0.0043858 0.00195880 1.364256e-03    sqrt N    \\sqrt N
#> 11: 0.0011483 0.0011904 0.0013366 0.00119586 8.058504e-05    sqrt N    \\sqrt N
#> 12: 0.0011812 0.0012867 0.0015610 0.00128420 1.619463e-04    sqrt N    \\sqrt N
#> 13: 0.0012383 0.0015014 0.0042498 0.00189772 1.319679e-03    sqrt N    \\sqrt N
#> 14: 0.0011960 0.0012889 0.0014630 0.00127886 1.128519e-04    sqrt N    \\sqrt N
#> 15: 0.0012402 0.0012473 0.0014563 0.00127934 1.003395e-04    sqrt N    \\sqrt N
#> 16: 0.0018368 0.0022347 0.0023005 0.00197418 2.857093e-04    sqrt N    \\sqrt N
#> 17: 0.0013556 0.0014519 0.0017170 0.00145250 1.541389e-04    sqrt N    \\sqrt N
#> 18: 0.0016249 0.0017838 0.0020031 0.00173066 1.690388e-04    sqrt N    \\sqrt N
#> 19: 0.0020602 0.0021654 0.0052575 0.00272328 1.418721e-03    sqrt N    \\sqrt N
#> 20: 0.0038864 0.0043753 0.0044194 0.00412300 2.642357e-04    sqrt N    \\sqrt N
#> 21: 0.0067227 0.0073171 0.0113723 0.00777640 2.026696e-03    sqrt N    \\sqrt N
#> 22: 0.0111640 0.0114285 0.0161702 0.01223046 2.209576e-03    sqrt N    \\sqrt N
#> 23: 0.0000532 0.0000728 0.0000821 0.00006290 1.377951e-05         N           N
#> 24: 0.0000509 0.0000608 0.0000745 0.00005758 1.051176e-05         N           N
#> 25: 0.0000603 0.0000961 0.0001524 0.00008896 3.919685e-05         N           N
#> 26: 0.0000823 0.0000971 0.0001195 0.00009292 1.629423e-05         N           N
#> 27: 0.0000739 0.0000857 0.0001025 0.00008192 1.289659e-05         N           N
#> 28: 0.0000975 0.0001268 0.0001503 0.00011600 2.319030e-05         N           N
#> 29: 0.0001439 0.0001567 0.0001869 0.00015538 1.846055e-05         N           N
#> 30: 0.0002433 0.0002596 0.0002764 0.00025336 1.469772e-05         N           N
#> 31: 0.0004445 0.0004584 0.0005815 0.00047670 5.896427e-05         N           N
#> 32: 0.0008712 0.0008843 0.0009238 0.00088366 2.333705e-05         N           N
#> 33: 0.0018057 0.0018481 0.0019882 0.00184518 8.407887e-05         N           N
#> 34: 0.0036312 0.0036826 0.0037822 0.00367560 6.515125e-05         N           N
#> 35: 0.0074430 0.0075370 0.0077606 0.00753376 1.326855e-04         N           N
#> 36: 0.0152820 0.0153386 0.0157406 0.01537652 2.078254e-04         N           N
#> 37: 0.0009286 0.0010178 0.0012030 0.00101742 1.121782e-04         N           N
#> 38: 0.0010281 0.0011458 0.0040596 0.00165924 1.343489e-03         N           N
#> 39: 0.0009521 0.0011557 0.0013932 0.00109104 1.884825e-04         N           N
#> 40: 0.0009389 0.0011181 0.0012065 0.00104276 1.177064e-04         N           N
#> 41: 0.0009732 0.0010133 0.0011069 0.00101208 5.755764e-05         N           N
#> 42: 0.0010158 0.0012094 0.0041163 0.00168050 1.364045e-03         N           N
#> 43: 0.0011937 0.0016400 0.0017019 0.00139098 2.602121e-04         N           N
#> 44: 0.0010389 0.0011841 0.0012376 0.00110922 9.478094e-05         N           N
#> 45: 0.0012446 0.0013403 0.0014768 0.00131696 9.768983e-05         N           N
#> 46: 0.0019933 0.0021710 0.0030509 0.00225402 4.535789e-04         N           N
#> 47: 0.0031122 0.0036146 0.0048064 0.00361796 7.104199e-04         N           N
#> 48: 0.0053607 0.0054775 0.0057058 0.00542912 1.848691e-04         N           N
#> 49: 0.0086578 0.0121598 0.0127088 0.01015324 2.093404e-03         N           N
#> 50: 0.0147375 0.0150593 0.0206498 0.01592830 2.648135e-03         N           N
#> 51: 0.0011618 0.0012164 0.0013412 0.00121002 7.718758e-05       N^2         N^2
#> 52: 0.0012162 0.0012753 0.0015303 0.00129116 1.420735e-04       N^2         N^2
#> 53: 0.0011810 0.0012568 0.0014148 0.00124858 9.910738e-05       N^2         N^2
#> 54: 0.0011788 0.0012383 0.0014064 0.00123984 9.650007e-05       N^2         N^2
#> 55: 0.0012259 0.0013099 0.0040423 0.00179934 1.254645e-03       N^2         N^2
#> 56: 0.0012616 0.0013092 0.0018160 0.00138476 2.420436e-04       N^2         N^2
#> 57: 0.0013741 0.0018138 0.0045021 0.00211274 1.348873e-03       N^2         N^2
#> 58: 0.0014009 0.0015984 0.0016459 0.00150072 1.161690e-04       N^2         N^2
#> 59: 0.0020210 0.0020765 0.0021692 0.00205844 6.769611e-05       N^2         N^2
#> 60: 0.0037469 0.0038203 0.0038401 0.00375532 1.162524e-04       N^2         N^2
#> 61: 0.0120893 0.0137015 0.0174490 0.01355828 2.290069e-03       N^2         N^2
#>           q25       q75       max       mean           sd  fun.name   fun.latex
#>                            expr.class                               expr.latex
#>                                <char>                                   <char>
#>  1:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  2:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  3:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  4:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  5:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  6:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  7:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  8:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#>  9:  changepoint::cpt.mean\nN^2 log N  changepoint::cpt.mean\n$O(N^2 \\log N)$
#> 10: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 11: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 12: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 13: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 14: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 15: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 16: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 17: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 18: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 19: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 20: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 21: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 22: binsegRcpp::binseg_normal\nsqrt N binsegRcpp::binseg_normal\n$O(\\sqrt N)$
#> 23:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 24:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 25:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 26:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 27:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 28:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 29:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 30:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 31:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 32:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 33:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 34:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 35:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 36:              fpop::multiBinSeg\nN                fpop::multiBinSeg\n$O(N)$
#> 37:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 38:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 39:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 40:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 41:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 42:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 43:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 44:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 45:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 46:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 47:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 48:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 49:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 50:                       wbs::sbs\nN                         wbs::sbs\n$O(N)$
#> 51:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 52:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 53:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 54:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 55:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 56:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 57:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 58:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 59:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 60:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#> 61:              binsegRcpp.list\nN^2                binsegRcpp.list\n$O(N^2)$
#>                            expr.class                               expr.latex
#>     empirical
#>         <num>
#>  1: 0.0003563
#>  2: 0.0003956
#>  3: 0.0004558
#>  4: 0.0005151
#>  5: 0.0006755
#>  6: 0.0011141
#>  7: 0.0028249
#>  8: 0.0096711
#>  9: 0.0436961
#> 10: 0.0012846
#> 11: 0.0011558
#> 12: 0.0012287
#> 13: 0.0012794
#> 14: 0.0012672
#> 15: 0.0012465
#> 16: 0.0018765
#> 17: 0.0013985
#> 18: 0.0016516
#> 19: 0.0021549
#> 20: 0.0040744
#> 21: 0.0068021
#> 22: 0.0113969
#> 23: 0.0000555
#> 24: 0.0000531
#> 25: 0.0000816
#> 26: 0.0000862
#> 27: 0.0000776
#> 28: 0.0001117
#> 29: 0.0001467
#> 30: 0.0002458
#> 31: 0.0004558
#> 32: 0.0008718
#> 33: 0.0018091
#> 34: 0.0036655
#> 35: 0.0074866
#> 36: 0.0152995
#> 37: 0.0010094
#> 38: 0.0010933
#> 39: 0.0010031
#> 40: 0.0010139
#> 41: 0.0010071
#> 42: 0.0010477
#> 43: 0.0012708
#> 44: 0.0010484
#> 45: 0.0012803
#> 46: 0.0020995
#> 47: 0.0035231
#> 48: 0.0054013
#> 49: 0.0087495
#> 50: 0.0147431
#> 51: 0.0011769
#> 52: 0.0012748
#> 53: 0.0012208
#> 54: 0.0012015
#> 55: 0.0012315
#> 56: 0.0012837
#> 57: 0.0015373
#> 58: 0.0014690
#> 59: 0.0020217
#> 60: 0.0038123
#> 61: 0.0127071
#>     empirical
try(if(require(ggplot2)){
  gg <- ggplot()+
    geom_line(aes(
      N, reference, group=fun.name),
      color=ref.color,
      data=time.refs)+
    geom_line(aes(
      N, empirical),
      linewidth=1,
      data=seconds.dt)+
    scale_x_log10()+
    scale_y_log10("median line, min/max band")+
    facet_wrap("expr.name")+
    theme_bw()
  if(require(directlabels)){
    gg+
      directlabels::geom_dl(aes(
        N, reference, label=fun.name),
        data=time.refs,
        color=ref.color,
        method="bottom.polygons")
  }else{
    gg
  }
})

Custom asymptotic references

If you have one or more expected time complexity classes that you want to compare with your empirical measurements, you can use the fun.list argument:

my.refs <- list(
  "N \\log N"=function(N)log10(N) + log10(log(N)),
  "N^2"=function(N)2*log10(N),
  "N^3"=function(N)3*log10(N))
my.best <- atime::references_best(atime.list, fun.list=my.refs)

Note that in the code above, each R function should take as input the data size N and output log base 10 of the reference function.

(my.best.time.refs <- my.best$ref[unit=="seconds"])
#>        unit                 expr.name fun.latex fun.name     N empirical
#>      <char>                    <char>    <char>   <char> <num>     <num>
#>  1: seconds     changepoint::cpt.mean N \\log N  N log N     8 0.0003956
#>  2: seconds     changepoint::cpt.mean N \\log N  N log N    16 0.0004558
#>  3: seconds     changepoint::cpt.mean N \\log N  N log N    32 0.0005151
#>  4: seconds     changepoint::cpt.mean N \\log N  N log N    64 0.0006755
#>  5: seconds     changepoint::cpt.mean N \\log N  N log N   128 0.0011141
#>  6: seconds     changepoint::cpt.mean N \\log N  N log N   256 0.0028249
#>  7: seconds     changepoint::cpt.mean N \\log N  N log N   512 0.0096711
#>  8: seconds     changepoint::cpt.mean N \\log N  N log N  1024 0.0436961
#>  9: seconds     changepoint::cpt.mean       N^2      N^2    64 0.0006755
#> 10: seconds     changepoint::cpt.mean       N^2      N^2   128 0.0011141
#> 11: seconds     changepoint::cpt.mean       N^2      N^2   256 0.0028249
#> 12: seconds     changepoint::cpt.mean       N^2      N^2   512 0.0096711
#> 13: seconds     changepoint::cpt.mean       N^2      N^2  1024 0.0436961
#> 14: seconds     changepoint::cpt.mean       N^3      N^3   128 0.0011141
#> 15: seconds     changepoint::cpt.mean       N^3      N^3   256 0.0028249
#> 16: seconds     changepoint::cpt.mean       N^3      N^3   512 0.0096711
#> 17: seconds     changepoint::cpt.mean       N^3      N^3  1024 0.0436961
#> 18: seconds binsegRcpp::binseg_normal N \\log N  N log N   256 0.0018765
#> 19: seconds binsegRcpp::binseg_normal N \\log N  N log N   512 0.0013985
#> 20: seconds binsegRcpp::binseg_normal N \\log N  N log N  1024 0.0016516
#> 21: seconds binsegRcpp::binseg_normal N \\log N  N log N  2048 0.0021549
#> 22: seconds binsegRcpp::binseg_normal N \\log N  N log N  4096 0.0040744
#> 23: seconds binsegRcpp::binseg_normal N \\log N  N log N  8192 0.0068021
#> 24: seconds binsegRcpp::binseg_normal N \\log N  N log N 16384 0.0113969
#> 25: seconds binsegRcpp::binseg_normal       N^2      N^2  2048 0.0021549
#> 26: seconds binsegRcpp::binseg_normal       N^2      N^2  4096 0.0040744
#> 27: seconds binsegRcpp::binseg_normal       N^2      N^2  8192 0.0068021
#> 28: seconds binsegRcpp::binseg_normal       N^2      N^2 16384 0.0113969
#> 29: seconds binsegRcpp::binseg_normal       N^3      N^3  4096 0.0040744
#> 30: seconds binsegRcpp::binseg_normal       N^3      N^3  8192 0.0068021
#> 31: seconds binsegRcpp::binseg_normal       N^3      N^3 16384 0.0113969
#> 32: seconds         fpop::multiBinSeg N \\log N  N log N   256 0.0001467
#> 33: seconds         fpop::multiBinSeg N \\log N  N log N   512 0.0002458
#> 34: seconds         fpop::multiBinSeg N \\log N  N log N  1024 0.0004558
#> 35: seconds         fpop::multiBinSeg N \\log N  N log N  2048 0.0008718
#> 36: seconds         fpop::multiBinSeg N \\log N  N log N  4096 0.0018091
#> 37: seconds         fpop::multiBinSeg N \\log N  N log N  8192 0.0036655
#> 38: seconds         fpop::multiBinSeg N \\log N  N log N 16384 0.0074866
#> 39: seconds         fpop::multiBinSeg N \\log N  N log N 32768 0.0152995
#> 40: seconds         fpop::multiBinSeg       N^2      N^2  2048 0.0008718
#> 41: seconds         fpop::multiBinSeg       N^2      N^2  4096 0.0018091
#> 42: seconds         fpop::multiBinSeg       N^2      N^2  8192 0.0036655
#> 43: seconds         fpop::multiBinSeg       N^2      N^2 16384 0.0074866
#> 44: seconds         fpop::multiBinSeg       N^2      N^2 32768 0.0152995
#> 45: seconds         fpop::multiBinSeg       N^3      N^3  8192 0.0036655
#> 46: seconds         fpop::multiBinSeg       N^3      N^3 16384 0.0074866
#> 47: seconds         fpop::multiBinSeg       N^3      N^3 32768 0.0152995
#> 48: seconds                  wbs::sbs N \\log N  N log N   256 0.0012708
#> 49: seconds                  wbs::sbs N \\log N  N log N   512 0.0010484
#> 50: seconds                  wbs::sbs N \\log N  N log N  1024 0.0012803
#> 51: seconds                  wbs::sbs N \\log N  N log N  2048 0.0020995
#> 52: seconds                  wbs::sbs N \\log N  N log N  4096 0.0035231
#> 53: seconds                  wbs::sbs N \\log N  N log N  8192 0.0054013
#> 54: seconds                  wbs::sbs N \\log N  N log N 16384 0.0087495
#> 55: seconds                  wbs::sbs N \\log N  N log N 32768 0.0147431
#> 56: seconds                  wbs::sbs       N^2      N^2  2048 0.0020995
#> 57: seconds                  wbs::sbs       N^2      N^2  4096 0.0035231
#> 58: seconds                  wbs::sbs       N^2      N^2  8192 0.0054013
#> 59: seconds                  wbs::sbs       N^2      N^2 16384 0.0087495
#> 60: seconds                  wbs::sbs       N^2      N^2 32768 0.0147431
#> 61: seconds                  wbs::sbs       N^3      N^3  8192 0.0054013
#> 62: seconds                  wbs::sbs       N^3      N^3 16384 0.0087495
#> 63: seconds                  wbs::sbs       N^3      N^3 32768 0.0147431
#> 64: seconds           binsegRcpp.list N \\log N  N log N    64 0.0012315
#> 65: seconds           binsegRcpp.list N \\log N  N log N   128 0.0012837
#> 66: seconds           binsegRcpp.list N \\log N  N log N   256 0.0015373
#> 67: seconds           binsegRcpp.list N \\log N  N log N   512 0.0014690
#> 68: seconds           binsegRcpp.list N \\log N  N log N  1024 0.0020217
#> 69: seconds           binsegRcpp.list N \\log N  N log N  2048 0.0038123
#> 70: seconds           binsegRcpp.list N \\log N  N log N  4096 0.0127071
#> 71: seconds           binsegRcpp.list       N^2      N^2   512 0.0014690
#> 72: seconds           binsegRcpp.list       N^2      N^2  1024 0.0020217
#> 73: seconds           binsegRcpp.list       N^2      N^2  2048 0.0038123
#> 74: seconds           binsegRcpp.list       N^2      N^2  4096 0.0127071
#> 75: seconds           binsegRcpp.list       N^3      N^3  1024 0.0020217
#> 76: seconds           binsegRcpp.list       N^3      N^3  2048 0.0038123
#> 77: seconds           binsegRcpp.list       N^3      N^3  4096 0.0127071
#>        unit                 expr.name fun.latex fun.name     N empirical
#>        reference  rank   i.N i.empirical i.reference i.rank        dist  sign
#>            <num> <num> <num>       <num>       <num>  <num>       <num> <num>
#>  1: 1.024127e-04     8   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  2: 2.731006e-04     7   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  3: 6.827516e-04     6   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  4: 1.638604e-03     5   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  5: 3.823409e-03     4   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  6: 8.739220e-03     3   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  7: 1.966325e-02     2   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  8: 4.369610e-02     1   512   0.0096711 0.019663245      2 -0.30817932    -1
#>  9: 1.706879e-04     5   512   0.0096711 0.010924025      2 -0.05290681    -1
#> 10: 6.827516e-04     4   512   0.0096711 0.010924025      2 -0.05290681    -1
#> 11: 2.731006e-03     3   512   0.0096711 0.010924025      2 -0.05290681    -1
#> 12: 1.092403e-02     2   512   0.0096711 0.010924025      2 -0.05290681    -1
#> 13: 4.369610e-02     1   512   0.0096711 0.010924025      2 -0.05290681    -1
#> 14: 8.534395e-05     4   512   0.0096711 0.005462013      2  0.24812318     1
#> 15: 6.827516e-04     3   512   0.0096711 0.005462013      2  0.24812318     1
#> 16: 5.462013e-03     2   512   0.0096711 0.005462013      2  0.24812318     1
#> 17: 4.369610e-02     1   512   0.0096711 0.005462013      2  0.24812318     1
#> 18: 1.017580e-04     7  8192   0.0068021 0.005291418      2  0.10907095     1
#> 19: 2.289556e-04     6  8192   0.0068021 0.005291418      2  0.10907095     1
#> 20: 5.087902e-04     5  8192   0.0068021 0.005291418      2  0.10907095     1
#> 21: 1.119338e-03     4  8192   0.0068021 0.005291418      2  0.10907095     1
#> 22: 2.442193e-03     3  8192   0.0068021 0.005291418      2  0.10907095     1
#> 23: 5.291418e-03     2  8192   0.0068021 0.005291418      2  0.10907095     1
#> 24: 1.139690e-02     1  8192   0.0068021 0.005291418      2  0.10907095     1
#> 25: 1.780766e-04     4  8192   0.0068021 0.002849225      2  0.37791627     1
#> 26: 7.123062e-04     3  8192   0.0068021 0.002849225      2  0.37791627     1
#> 27: 2.849225e-03     2  8192   0.0068021 0.002849225      2  0.37791627     1
#> 28: 1.139690e-02     1  8192   0.0068021 0.002849225      2  0.37791627     1
#> 29: 1.780766e-04     3  8192   0.0068021 0.001424612      2  0.67894626     1
#> 30: 1.424612e-03     2  8192   0.0068021 0.001424612      2  0.67894626     1
#> 31: 1.139690e-02     1  8192   0.0068021 0.001424612      2  0.67894626     1
#> 32: 6.374792e-05     8 16384   0.0074866 0.007139767      2  0.02060061     1
#> 33: 1.434328e-04     7 16384   0.0074866 0.007139767      2  0.02060061     1
#> 34: 3.187396e-04     6 16384   0.0074866 0.007139767      2  0.02060061     1
#> 35: 7.012271e-04     5 16384   0.0074866 0.007139767      2  0.02060061     1
#> 36: 1.529950e-03     4 16384   0.0074866 0.007139767      2  0.02060061     1
#> 37: 3.314892e-03     3 16384   0.0074866 0.007139767      2  0.02060061     1
#> 38: 7.139767e-03     2 16384   0.0074866 0.007139767      2  0.02060061     1
#> 39: 1.529950e-02     1 16384   0.0074866 0.007139767      2  0.02060061     1
#> 40: 5.976367e-05     5 16384   0.0074866 0.003824875      2  0.29166738     1
#> 41: 2.390547e-04     4 16384   0.0074866 0.003824875      2  0.29166738     1
#> 42: 9.562187e-04     3 16384   0.0074866 0.003824875      2  0.29166738     1
#> 43: 3.824875e-03     2 16384   0.0074866 0.003824875      2  0.29166738     1
#> 44: 1.529950e-02     1 16384   0.0074866 0.003824875      2  0.29166738     1
#> 45: 2.390547e-04     3 16384   0.0074866 0.001912437      2  0.59269738     1
#> 46: 1.912437e-03     2 16384   0.0074866 0.001912437      2  0.59269738     1
#> 47: 1.529950e-02     1 16384   0.0074866 0.001912437      2  0.59269738     1
#> 48: 6.142958e-05     8 16384   0.0087495 0.006880113      2  0.10438764     1
#> 49: 1.382166e-04     7 16384   0.0087495 0.006880113      2  0.10438764     1
#> 50: 3.071479e-04     6 16384   0.0087495 0.006880113      2  0.10438764     1
#> 51: 6.757254e-04     5 16384   0.0087495 0.006880113      2  0.10438764     1
#> 52: 1.474310e-03     4 16384   0.0087495 0.006880113      2  0.10438764     1
#> 53: 3.194338e-03     3 16384   0.0087495 0.006880113      2  0.10438764     1
#> 54: 6.880113e-03     2 16384   0.0087495 0.006880113      2  0.10438764     1
#> 55: 1.474310e-02     1 16384   0.0087495 0.006880113      2  0.10438764     1
#> 56: 5.759023e-05     5 16384   0.0087495 0.003685775      2  0.37545442     1
#> 57: 2.303609e-04     4 16384   0.0087495 0.003685775      2  0.37545442     1
#> 58: 9.214438e-04     3 16384   0.0087495 0.003685775      2  0.37545442     1
#> 59: 3.685775e-03     2 16384   0.0087495 0.003685775      2  0.37545442     1
#> 60: 1.474310e-02     1 16384   0.0087495 0.003685775      2  0.37545442     1
#> 61: 2.303609e-04     3 16384   0.0087495 0.001842888      2  0.67648441     1
#> 62: 1.842888e-03     2 16384   0.0087495 0.001842888      2  0.67648441     1
#> 63: 1.474310e-02     1 16384   0.0087495 0.001842888      2  0.67648441     1
#> 64: 9.927422e-05     7  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 65: 2.316398e-04     6  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 66: 5.294625e-04     5  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 67: 1.191291e-03     4  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 68: 2.647313e-03     3  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 69: 5.824088e-03     2  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 70: 1.270710e-02     1  2048   0.0038123 0.005824088      2 -0.18404082    -1
#> 71: 1.985484e-04     4  2048   0.0038123 0.003176775      2  0.07920061     1
#> 72: 7.941938e-04     3  2048   0.0038123 0.003176775      2  0.07920061     1
#> 73: 3.176775e-03     2  2048   0.0038123 0.003176775      2  0.07920061     1
#> 74: 1.270710e-02     1  2048   0.0038123 0.003176775      2  0.07920061     1
#> 75: 1.985484e-04     3  2048   0.0038123 0.001588388      2  0.38023061     1
#> 76: 1.588388e-03     2  2048   0.0038123 0.001588388      2  0.38023061     1
#> 77: 1.270710e-02     1  2048   0.0038123 0.001588388      2  0.38023061     1
#>        reference  rank   i.N i.empirical i.reference i.rank        dist  sign
#>     overall.rank each.sign.rank
#>            <num>          <num>
#>  1:            3              2
#>  2:            3              2
#>  3:            3              2
#>  4:            3              2
#>  5:            3              2
#>  6:            3              2
#>  7:            3              2
#>  8:            3              2
#>  9:            1              1
#> 10:            1              1
#> 11:            1              1
#> 12:            1              1
#> 13:            1              1
#> 14:            2              1
#> 15:            2              1
#> 16:            2              1
#> 17:            2              1
#> 18:            1              1
#> 19:            1              1
#> 20:            1              1
#> 21:            1              1
#> 22:            1              1
#> 23:            1              1
#> 24:            1              1
#> 25:            2              2
#> 26:            2              2
#> 27:            2              2
#> 28:            2              2
#> 29:            3              3
#> 30:            3              3
#> 31:            3              3
#> 32:            1              1
#> 33:            1              1
#> 34:            1              1
#> 35:            1              1
#> 36:            1              1
#> 37:            1              1
#> 38:            1              1
#> 39:            1              1
#> 40:            2              2
#> 41:            2              2
#> 42:            2              2
#> 43:            2              2
#> 44:            2              2
#> 45:            3              3
#> 46:            3              3
#> 47:            3              3
#> 48:            1              1
#> 49:            1              1
#> 50:            1              1
#> 51:            1              1
#> 52:            1              1
#> 53:            1              1
#> 54:            1              1
#> 55:            1              1
#> 56:            2              2
#> 57:            2              2
#> 58:            2              2
#> 59:            2              2
#> 60:            2              2
#> 61:            3              3
#> 62:            3              3
#> 63:            3              3
#> 64:            2              1
#> 65:            2              1
#> 66:            2              1
#> 67:            2              1
#> 68:            2              1
#> 69:            2              1
#> 70:            2              1
#> 71:            1              1
#> 72:            1              1
#> 73:            1              1
#> 74:            1              1
#> 75:            3              2
#> 76:            3              2
#> 77:            3              2
#>     overall.rank each.sign.rank
try(if(require(ggplot2)){
  gg <- ggplot()+
    geom_line(aes(
      N, reference, group=fun.name),
      color=ref.color,
      data=my.best.time.refs)+
    geom_line(aes(
      N, empirical),
      linewidth=1,
      data=seconds.dt)+
    scale_x_log10()+
    scale_y_log10("median line, min/max band")+
    facet_wrap("expr.name")+
    theme_bw()
  if(require(directlabels)){
    gg+
      directlabels::geom_dl(aes(
        N, reference, label=fun.name),
        data=my.best.time.refs,
        color=ref.color,
        method="bottom.polygons")
  }else{
    gg
  }
})

From the plot above you should be able to see the asymptotic time complexity class of each algorithm.

  • the fastest packages are log-linear (fpop, wbs, binsegRcpp),
  • that the binsegRcpp implementation that uses the list container is much slower (quadratic).
  • the changepoint package uses a super-quadratic algorithm (actually cubic, which you could see if you increase N even larger).

Exercises for the reader

  • increase seconds.limit to see the differences more clearly.
  • compute and plot asymptotic references for memory instead of time (including expected memory complexity, linear).