Skip to content

Instantly share code, notes, and snippets.

@is8ac
is8ac / rust optimization perf.md
Created January 4, 2021 02:50
2 implementations of the same algorithm, 6 different input sizes, 6 rustc optimization parameters

default release opt

version segs threads input pixel size output pixel size n params ms per example ns per pixel bit ns per channel ns per parameter
3 2 16 32 32 9216 32.938 1030182.004 1030182.004 3577.021
3 2 16 64 32 18432 64.750 1011854.566 2023709.133 3513.384
3 2 16 128 32 36864 129.938 1015413.960 4061655.842 3525.743
3 2 16 256 32 73728 277.000 1082303.786 8658430.289 3757.999
3 2 16 512 32 147456 568.000

Keybase proof

I hereby claim:

  • I am is8ac on github.
  • I am is8ac (https://keybase.io/is8ac) on keybase.
  • I have a public key ASDWVFox5jMFu9zBe9PpPRIFnjiaaVMyltPKW72Lw1333Ao

To claim this, I am signing this object:

This is basically unconsciousness as cultures as anyone think at a hitching
or traditional enforcement synding - supposedly, if they definate us, far, emotional failures,
and totalizing views on everybody else, then we're good for the one thing I
was being a hostlune of reverence. There are way for necessary flours
before/women in the population in favor of the interesting process to speaking
somewhere. They allow 18 coherent self-serviced population gas and
guns, helping to seen them $20 coutrageous ends.
@is8ac
is8ac / projectEuler.py
Last active August 29, 2015 14:19
My python to the solve the problems on Project Euler.
# Problem 1
# sum is the sum of the numbers so far.
sum = 0
# n is the number that is being tried.
n = 0
# While n is less then 1000,
while (n < 1000):
# And when n/3 or n/5 has a remainder of 0,
if n % 3 == 0 or n % 5 == 0:
@is8ac
is8ac / prime-gap-frequency.R
Created March 18, 2015 22:21
Calculate prime gaps, and then plots their frequency.
# Set prime to a subset of the full prime list so it won't take forever to compute.
prime <- prime6[1:100000,]
# Calculate the prime gaps.
for(n in 2:length(prime$index)){
prime$gap[n] <-prime$prime[n] - prime$prime[n-1]
}
# Now find the frequency of the first 100 prime gaps.
gapLength <- list()
for(gapN in (1:100)){
gapLength$gap[gapN] <- gapN
@is8ac
is8ac / brute-force-probability.R
Created March 18, 2015 00:10
Two jars, one containing three red, five green, and two yellow balls, the other containing five red, one green, and four yellow balls, if a single ball is drawn from each jar, what is the probability that at least one is green?
n <- 2^16
sampleOut <- list()
# Put balls in the two jars.
jar1 <- c("red","red","red","green","green","green","green","green","yellow","yellow")
jar2 <- c("red","red","red","red","red","green","yellow","yellow","yellow","yellow")
# Do the following n times.
for(place in 1:n){
# Take a random ball from each of the two jars
jar1Samp <- sample(jar1,1)
jar2Samp <- sample(jar2,1)