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

merge could utilize i index #4380

Closed
jangorecki opened this issue Apr 15, 2020 · 1 comment · Fixed by #4386
Closed

merge could utilize i index #4380

jangorecki opened this issue Apr 15, 2020 · 1 comment · Fixed by #4386
Assignees

Comments

@jangorecki
Copy link
Member

# data gen
Rscript -e 'library(data.table); set.seed(108); N = 1e8; fwrite(data.table(id = sample(N), v1=1L), "d1.csv"); fwrite(data.table(id = sample(N), v2=2L), "d2.csv")'

# join
R -q
library(data.table)
d1 = fread("d1.csv")
d2 = fread("d2.csv")
system.time(d1[d2, on="id"])
#   user  system elapsed 
# 51.929   9.861  24.909 
q("no")

R -q
library(data.table)
d1 = fread("d1.csv")
d2 = fread("d2.csv", key="id")
system.time(d1[d2, on="id"])
#   user  system elapsed 
# 29.645   6.587  13.537 
q("no")

R -q
library(data.table)
d1 = fread("d1.csv")
d2 = fread("d2.csv", index="id")
system.time(d1[d2, on="id"])
#   user  system elapsed 
# 51.679   9.918  23.874 
q("no")
@jangorecki
Copy link
Member Author

jangorecki commented Apr 20, 2020

timings of above script using #4386

op no-idx idx note
forder1 0.937 1.294  
forder2 1.197 0  
bmerge_r 16.898 15.744  
bmerge 18.522 16.155 includes bmerge_r and forder2
forder3 0.416 0.423  
total 24.796 23.410

one forder call eliminated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant