Created
February 11, 2014 14:43
-
-
Save isomorphisms/8936092 to your computer and use it in GitHub Desktop.
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
require(microbenchmark) | |
# ζ is U+3b6 in Ubuntu | |
ready.set.go.10000000 <- microbenchmark( "ζ <- complex(0); for (j in 1:1e6) ζ <- c(ζ,complex(argument=j/1e6*2*pi,modulus=1) )", "ζ <- complex(1e6); for (j in 1:1e6) ζ[j] <- complex(argument=j/1e6*2*pi, modulus=1)", "ζ <- complex( argument=1:1e6*2*pi, modulus=1 )" ) | |
a<-Sys.time(); ready.set.go.10000000 <- microbenchmark( "ζ <- complex(0); for (j in 1:1e7) ζ <- c(ζ,complex(argument=j/1e7*2*pi,modulus=1) )", "ζ <- complex(1e7); for (j in 1:1e7) ζ[j] <- complex(argument=j/1e7*2*pi, modulus=1)", "ζ <- complex( argument=1:1e7*2*pi, modulus=1 ))" ,times=5e4L); b<-Sys.time() | |
b-a | |
#one of those may have a typo but hopefully not both do | |
levels(ready.set.go.10000000$expr) <- cbind( 'grow', 'subscript', 'colon' ) | |
boxplot( ready.set.go.10000000 , pch=20, col=rgb(.1,.1,.1,.7) , boxwex=.3,outline=FALSE,notch=TRUE, main="time to grow a million roots of unity", sub="by various methods" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment