Last active
December 17, 2015 13:19
-
-
Save piccolbo/5616152 to your computer and use it in GitHub Desktop.
Assignment to R named arrays is quadratic (when extending at the same time)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name.me = c() | |
system.time({name.me[as.character(1:10^3)] = T}) | |
# user system elapsed | |
# 0.004 0.000 0.004 | |
system.time({name.me[as.character(1:10^4)] = T}) | |
# user system elapsed | |
# 0.369 0.000 0.369 | |
system.time({name.me[as.character(1:10^5)] = T}) | |
# user system elapsed | |
# 48.187 0.055 48.235 | |
system.time({name.me[as.character(1:10^5)] = F}) | |
# user system elapsed | |
# 0.033 0.001 0.035 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In one word: avoid