You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setkeyv() can be accelerated significantly in cases where the key already exists.
This can be useful e.g. if you create a function that takes a data.table as an argument and you need to set a key but don't know if the user has already set the key on the input.
With the new implementation, you can just use setkey without worrying about speed penalties.
setkeyv() does two things:
determine the correct sorting calling forderv
Rearranging the data.table by reference calling Creorder
Currently, if the key already exists, the call to forderv is still executed and only step 2 is skipped.
The only reason is a sanity check that the data.table is really sorted by the key.
I believe, it is not necessary to perform this sanity check each time, especially since it has been around for quite a while so that potential bugs should have popped up.
The text was updated successfully, but these errors were encountered:
@MarkusBonsch thanks for doing this. I had hacky work-arounds that did this myself, and I didn't get to actually submit a PR. And of course thanks to the data.table team for all they do.
setkeyv() can be accelerated significantly in cases where the key already exists.
This can be useful e.g. if you create a function that takes a data.table as an argument and you need to set a key but don't know if the user has already set the key on the input.
With the new implementation, you can just use setkey without worrying about speed penalties.
setkeyv() does two things:
forderv
Creorder
Currently, if the key already exists, the call to
forderv
is still executed and only step 2 is skipped.The only reason is a sanity check that the data.table is really sorted by the key.
I believe, it is not necessary to perform this sanity check each time, especially since it has been around for quite a while so that potential bugs should have popped up.
The text was updated successfully, but these errors were encountered: