From b145d7450de0d7672f5f6b693cf80b56349798fd Mon Sep 17 00:00:00 2001 From: Jason Knight Date: Sat, 18 Nov 2017 10:08:33 -0800 Subject: [PATCH] SIMD (arch=native build) for Rust For me, allowing LLVM to target native CPU instructions gives a nearly 2x speedup (and it's a single line change!). Before: ``` ------------------------------------------------------------------------------------------------- benchmark: 10 tests -------------------------------------------------------------------------------------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ test_rust_bytes_once 463.7750 (1.0) 2,320.4550 (1.0) 467.5096 (1.0) 44.6473 (1.0) 465.6775 (1.0) 1.9260 (1.0) 15;122 2,138.9934 (1.0) 1830 1 ``` After: ``` ----------------------------------------------------------------------------------------------- benchmark: 10 tests ------------------------------------------------------------------------------------------------ Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_rust_bytes_once 289.5610 (1.0) 2,190.4260 (1.04) 301.0328 (1.0) 38.1051 (1.0) 299.3540 (1.0) 1.8437 (1.30) 62;823 3,321.8976 (1.0) 2883 1 ``` --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 53ae741..847f8ec 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ test-all: ## run tests quickly with the default Python py.test -v -s doubles_all.py compile-rust: ## compile new rust lib - @cd pyext-myrustlib;cargo build --release + @cd pyext-myrustlib;RUSTFLAGS="-C target-cpu=native" cargo build --release @cp pyext-myrustlib/target/release/libmyrustlib.so myrustlib.so compile-c: ## compile new c lib