From 08fd0f1320be28804e7cf59d3ce0852459907c00 Mon Sep 17 00:00:00 2001 From: Clonkk Date: Sun, 16 Jun 2024 19:50:04 +0200 Subject: [PATCH] update results --- examples/numpyarrays/examply.py | 7 ++++- examples/numpyarrays/results.txt | 46 ++++++++++++++++---------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/examples/numpyarrays/examply.py b/examples/numpyarrays/examply.py index 10cae2a..7784bd3 100644 --- a/examples/numpyarrays/examply.py +++ b/examples/numpyarrays/examply.py @@ -1,6 +1,7 @@ import examply import numpy as np from timeit import default_timer as timer +import multiprocessing def fLoop(ar): s = 0.0 @@ -17,8 +18,12 @@ def fLoop(ar): def main(): print("Python => main()") MAX_X = int(3*1e3) - MAX_Y = int(2*1e4) + MAX_Y = int(3*1e3) MAX_LEN = int(MAX_X*MAX_Y) + print("CPU COUNT=", multiprocessing.cpu_count()) + print("MAX_X=", MAX_X) + print("MAX_Y=", MAX_Y) + print("MAX_LEN=", MAX_LEN) ar = np.random.rand(MAX_X, MAX_Y) print("BEGIN") diff --git a/examples/numpyarrays/results.txt b/examples/numpyarrays/results.txt index c33a9c5..97f6cea 100644 --- a/examples/numpyarrays/results.txt +++ b/examples/numpyarrays/results.txt @@ -1,33 +1,33 @@ Python => main() +CPU COUNT= 8 +MAX_X= 3000 +MAX_Y= 3000 +MAX_LEN= 9000000 BEGIN ---------------- -[[0.60475077 0.44413095 0.46564047 ... 0.47212688 0.68146299 0.12783958] - [0.98983087 0.67538494 0.13498299 ... 0.32210424 0.90469584 0.56615492] - [0.50289262 0.73438084 0.67021523 ... 0.35588945 0.69781675 0.78326607] +[[0.26194446 0.08192133 0.55000653 ... 0.8309888 0.58720536 0.02474165] + [0.73023235 0.5942633 0.68405983 ... 0.53193958 0.06570396 0.37570736] + [0.67471879 0.30205339 0.99211628 ... 0.23007753 0.08021201 0.53655033] ... - [0.93074486 0.37784018 0.71430288 ... 0.89912398 0.80890871 0.76614078] - [0.80702007 0.37779148 0.79672089 ... 0.17169144 0.68481681 0.07518684] - [0.21838055 0.43156273 0.83545144 ... 0.67567453 0.55417085 0.86909124]] + [0.53500795 0.67878598 0.82899082 ... 0.6583351 0.82552753 0.13155744] + [0.5549234 0.55656235 0.86248167 ... 0.72473359 0.18438149 0.60065313] + [0.86027365 0.24390531 0.57120545 ... 0.69851604 0.81229157 0.07272132]] 1) ------------------------- -30000 -20000 ------------------------- -res= 231784157.45953572 -Python loop took : 122.96784695895622 seconds -pyres= 231784157.45953572 -Python measured native loop took : 0.5876745420391671 seconds -Nim measured native loop took : 587.645 ms -res= 231784157.45953572 +res= 3477241.833174428 +Python loop took : 3.6015096540213563 seconds +pyres= 3477241.833174428 +Python measured native loop took : 0.018548287014709786 seconds +Nim measured native loop took : 18.52 ms +res= 3477241.833174428 2) Showing in-place mod -[0.60475077 0.44413095 0.46564047] -[123. -5. 0.46564047] +[0.26194446 0.08192133 0.55000653] +[123. -5. 0.55000653] 3) Comparing for loops -normalForOp: 0.4645314170047641 seconds -indexedOp: 0.8829496669932269 seconds -parallelForOp: 0.13061370799550787 seconds -parallelIndexedForOp: 0.15869620797457173 seconds -Native python for: 177.12224933301331 seconds +normalForOp: 0.03445864300010726 seconds +indexedOp: 0.04115106599056162 seconds +parallelForOp: 0.00984231400070712 seconds +parallelIndexedForOp: 0.024510202987585217 seconds +Native python for: 5.1321438050072175 seconds False False True