Skip to content

Instantly share code, notes, and snippets.

python test.py
test1arr for 100000000 primes: write directly to array with new generate_n_primes_array 2.82 sec
test1iter for 100000000 primes: write to numpy data using iter interface: 3.65 sec
test1iter2 for 100000000 primes: write to numpy data using iter interface data access: 3.40 sec
test1np for 100000000 primes: use normal vector generation but copy directly to numpy on output: 4.16 sec
test2 for 100000000 primes: current vector generate_n_primes with numpy copy from vector to output list: 21.03 sec
test2a for 100000000 primes: current vector, copy to output list, create numpy array: 36.25 sec
@pstoll
pstoll / results.txt
Created November 15, 2015 19:19
Test timing of writing arrays in place vs using vectors for numpy primesieve bindings
pstoll$ python test.py
test1 arrays: 6.956779105006717
test1a arrays: 6.8869501760054845
test2 native vectors: 59.97818154899869
test2a native vectors: 90.65342697499727
diff --git a/setup.py b/setup.py
index b8b003b..e8bf426 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,16 @@
from setuptools import setup, Extension
from glob import glob
+import os
+
+os.environ["CC"] = "/usr/local/bin/clang-omp -fopenmp"
--- src/http/ngx_http_variables.c.orig 2010-01-11 03:21:46.000000000 -0800
+++ src/http/ngx_http_variables.c 2010-02-18 10:01:32.000000000 -0800
@@ -93,6 +93,9 @@
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+
/*
@pstoll
pstoll / remsh.erl
Created July 25, 2013 17:11 — forked from davisp/remsh.erl
#! /usr/bin/env escript
%%! -hidden -noshell -noinput
-mode(compile).
-export([
init_shell_log/1
]).
@pstoll
pstoll / golang-tour-47.go
Created November 18, 2012 21:43
Cube root example in GoLang tour #47
package main
import "fmt"
import "math/cmplx"
func Cbrt(x complex128) complex128 {
z:=complex128(1.0)
min_delta := float64(0.00000000001)
delta := complex128(1.0)
var iter int
@pstoll
pstoll / gist:4107103
Created November 18, 2012 19:45
Golang tour 48 fibanacci using a closure
// http://tour.golang.org/#48
//
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
prev := 0;
@pstoll
pstoll / gist:4107025
Last active October 12, 2015 23:57
golang tour 45
package main
// http://tour.golang.org/#46
// question - is this efficient?
// ie is range operator returning refs or copies of the string elements?
import (
"tour/wc"
"strings"
)
@pstoll
pstoll / tour-golang.go
Created November 18, 2012 19:18
Go sqrt example
// http://tour.golang.org/#45
// by Perry Stoll
package main
import (
"fmt"
"math"
)