Skip to content

Instantly share code, notes, and snippets.

@MostAwesomeDude
Created April 19, 2021 01:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Script for trying to reproduce https://laurenar.net/posts/python-simd/
import random
try:
from numba import jit
except:
def jit(**kwargs):
return lambda f: f
@jit(nopython=True)
def arr_sum(arr):
total = 0
for i in range(len(arr)):
total += arr[i]
return total
# Invariant: Always has the same elements and thus the same sum.
l = list(range(65000))
def a():
random.shuffle(l)
def b():
return arr_sum(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment