Open DorisAmoakohene opened 5 days ago
that is a good start. maybe you can use perl=TRUE or FALSE instead of engine=PCRE or TRE? That would be a good example to discuss atime_grid function too. For a more complex example of how to use bench::press see https://github.com/tdhock/atime/pull/68/commits/7aed80d21c02732180283fc64292a60ab32e6117 (probably should be simplified for paper though)
here is an improvement / simplication of your proposal for comparing PCRE and TRE,
max.N <- 20
(subject.size.vec <- unique(as.integer(10^seq(0, log10(max.N), l = 20))))
create_subject_pattern <- function(N)list(
subject=paste(rep("a", N), collapse = ""),
pattern=paste(rep(c("a?", "a"), each = N), collapse = ""))
perl.values <- c(TRUE,FALSE)
press_result <- bench::press(
N = subject.size.vec,
perl = perl.values,
with(create_subject_pattern(N), bench::mark(
iterations = 10,
regexpr(pattern, subject, perl = perl))))
library(ggplot2)
gg <- ggplot()+
geom_line(aes(
N, as.numeric(median), color=perl),
data=press_result)+
scale_x_log10(limits=c(NA,max.N*2))+
scale_y_log10()
directlabels::direct.label(gg,"right.polygons")
atime_result <- atime::atime(
N = subject.size.vec,
setup=N.data <- create_subject_pattern(N),
expr.list=atime::atime_grid(list(
perl=perl.values),
regexpr=regexpr(N.data$pattern, N.data$subject, perl = perl)))
plot(atime_result)
@tdhock I have the above and see result below
max.N <- 20
(subject.size.vec <- unique(as.integer(10^seq(0, log10(max.N), l = 20))))
create_subject_pattern <- function(N)list(
subject=paste(rep("a", N), collapse = ""),
pattern=paste(rep(c("a?", "a"), each = N), collapse = ""))
perl.values <- c(TRUE,FALSE)
press_result <- bench::press(
N = subject.size.vec,
perl = perl.values,
with(create_subject_pattern(N), bench::mark(
iterations = 10,
regexpr(pattern, subject, perl = perl))))
library(ggplot2)
gg <- ggplot()+
geom_line(aes(
N, as.numeric(median), color=perl),
data=press_result)+
scale_x_log10(limits=c(NA,max.N*2))+
scale_y_log10()
directlabels::direct.label(gg,"right.polygons")
atime_result <- atime::atime(
N = subject.size.vec,
setup=N.data <- create_subject_pattern(N),
expr.list=atime::atime_grid(list(
perl=perl.values),
regexpr=regexpr(N.data$pattern, N.data$subject, perl = perl)))
press_result
atime_result
@tdhock I saw a table like this in you paper on Reshaping
pkg::function | single | multiple | regex | na.rm | types | list |
---|---|---|---|---|---|---|
atime::atime | yes | yes | no | yes | numeric | yes |
atime::atime_pkg | yes | yes | no | yes | numeric | yes |
bench::press | no | yes | no | no | numeric | no |
single: Whether the function supports evaluating a single expression. multiple: Whether the function supports evaluating multiple expressions or combinations. regex: Whether the function uses or supports regex for selecting parameters or processing input. na.rm: Whether the function has an option to remove NA values. types: Types of data supported (e.g., numeric, character, any). list: Whether the function can handle lists or list-like structures.
what do you think about adding a this to the related work. or in the bench::press comparison with atime section.
what do you think about adding a this to the related work. or in the bench::press comparison with atime section.
Don't you already have bench in Table 1?
@tdhock I want to include this to the section on Comparing bench::press and atime::atime, what do you think ? and how best can I go about it.
atime.list
results