# NOT RUN {
x <- replicate(10e3,
paste0(sample(letters, 12, TRUE),
collapse = "")
)
y <- rnorm(length(x))
z <- sample(x, 100)
H <- hashmap(x, y)
all.equal(y[match(z, x)], H[[z]])
# }
# NOT RUN {
microbenchmark::microbenchmark(
"R" = y[match(z, x)],
"H" = H[[z]],
times = 500L
)
# }
Run the code above in your browser using DataLab