Skip to content

Instantly share code, notes, and snippets.

@mGalarnyk
Created September 1, 2021 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mGalarnyk/8c491fbdfe6ce3e498a7f62f03fa9ca4 to your computer and use it in GitHub Desktop.
Save mGalarnyk/8c491fbdfe6ce3e498a7f62f03fa9ca4 to your computer and use it in GitHub Desktop.
import math
import numpy as np
from timebudget import timebudget
iterations_count = round(1e7)
def complex_operation(input_index):
print("Complex operation. Input index: {:2d}".format(input_index))
[math.exp(i) * math.sinh(i) for i in [1] * iterations_count]
@timebudget
def run_complex_operations(operation, input):
for i in input:
operation(i)
input = range(10)
run_complex_operations(complex_operation, input)
@mGalarnyk
Copy link
Author

While that would likely work, I coded it the original way so that the rest of the tutorial can easily build off this code snippet.

@mwtian
Copy link

mwtian commented Sep 9, 2021

Sounds good! My previous suggestion makes little sense.

@Agrover112
Copy link

Which Mac processor are you using there btw?

@mGalarnyk
Copy link
Author

Not M1. Honestly would like to do a more extensive set of testing when i have time with different processors, cores, and more as well as include more technologies: https://twitter.com/rasbt/status/1438557627169099777

@Agrover112
Copy link

Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz, 2592 Mhz, 6 Core(s), 12 Logical Processor(s), this is the current Processor I'm using maybe I could run your scripts and add results?

@mGalarnyk
Copy link
Author

I have a better idea! Why don't you make another blog post with blocking or non blocking IO operations to have a more comprehensive set of benchmarks? I say this so that you can make your own opinion of each library and share that :)

Rather than adding to current blog, I will write another blog in the future with some more libraries as it definitely seems there are a ton of other libraries to include (joblib, dask, mpire to name a few) with a lot of different use cases, integrations, syntaxes (following each libraries best practices is important) and data sizes. Honestly, I really want to vary data sizes and see how well each library performs. Problem is making this sort of blog may take a bit of time to make, but should be fun :)

@Agrover112
Copy link

I have a better idea! Why don't you make another blog post with blocking or non blocking IO operations to have a more comprehensive set of benchmarks? I say this so that you can make your own opinion of each library and share that :)

Rather than adding to current blog, I will write another blog in the future with some more libraries as it definitely seems there are a ton of other libraries to include (joblib, dask, mpire to name a few) with a lot of different use cases, integrations, syntaxes (following each libraries best practices is important) and data sizes. Honestly, I really want to vary data sizes and see how well each library performs. Problem is making this sort of blog may take a bit of time to make, but should be fun :)

I am not realy sure of what operations would classify as blocking and non- io blocking ?

@mGalarnyk
Copy link
Author

Oh dont worry about it then! It is not always easy to find that out unfortunately :(

Just suggesting you write. Every benchmark isn't perfect so I was suggesting you try your own :)

@Agrover112
Copy link

Yea , I will try and see if I get time :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment