Тёмный

The EASY Way To Time Your Python Code Performance (ft. timeit) 

Indently
Подписаться 213 тыс.
Просмотров 12 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 19   
@dihydrogen
@dihydrogen Год назад
when it comes to modules with timeit, i've found that passing globals=globals() could be a good alternative to setup parameter, especially when there are many modules to worry about in your timeit. although this would require you to actually import the modules in your python file, i'm sure you would have done that already. but you also would be able to use variables in the global scope edit: it has been 8 minutes in. this is mentioned. i shall now eat my legs, for that would be the only way to correct this mistake
@chx75
@chx75 Год назад
Why is repeat a different function than timeit? They could just make repeat an option in timeit. Damn "typed" programmers.
@Indently
@Indently Год назад
Yeah I found that interesting as well. Couldn’t tell you why they did that. Maybe it added far too much complexity to timeit. Or maybe they wanted to make sure that users understood that one returns a list of floats, while the other just returns a float. Those are just my ideas :)
@davislayton1558
@davislayton1558 Год назад
I got ths error when running your code in the globals section of the video: " def list_generate_random(amount: int) -> list[float]: TypeError: 'type' object is not subscriptable "
@ButchCassidyAndSundanceKid
@ButchCassidyAndSundanceKid Год назад
Pretty useful. Thanks.
@sauravsharma1085
@sauravsharma1085 Год назад
We can also use Samay module to get execution time and visualization of execution of a function.
@bart75_38
@bart75_38 Год назад
Can you make a video on multi prossesing in python? Need to know how to do it So i can same my self 30min a Day.
@Indently
@Indently Год назад
Unlikely I will bring it to the channel any time in the near future, but if you're more than welcome to learn it from my full Python course on indently.io
@eddymoreno5624
@eddymoreno5624 Год назад
I got the utility of using typing in function parameters and returns but specifing the type of everything is too much when is obvius
@cerealport2726
@cerealport2726 2 месяца назад
so don't do it that way... no one is forcing you to do anything....
@paljain01
@paljain01 Год назад
i used timeit's default_timer from timeit import default_timer as timer start = timer() """some statements talking to DB""" print(f"Time Taken: {timer()-start} sec.")
@Indently
@Indently Год назад
Why are you doing these crazy gymnastics when default_timer literally just uses perf_counter? Just curious
@paljain01
@paljain01 Год назад
@@Indently no specific reason. I got it from a stackoverflow answer using this since like this only. maybe because default_timer feels natural than perf_counter. good to know I can do this from the time module only. thx.
@pawejerzyna5674
@pawejerzyna5674 11 месяцев назад
great video, thanks
@gurudevnayak7664
@gurudevnayak7664 8 месяцев назад
speak english!!!!
@Indently
@Indently 8 месяцев назад
Like British English?
Далее
Use “@cached_property” For FASTER Python Classes
4:28
5 Good Python Habits
17:35
Просмотров 545 тыс.
#慧慧很努力#家庭搞笑#生活#亲子#记录
00:11
10 Crazy Python Operators That I Rarely Use
11:37
Просмотров 18 тыс.
25 nooby Python habits you need to ditch
9:12
Просмотров 1,8 млн
How To Write Better Functions In Python
14:17
Просмотров 27 тыс.
The Value of Source Code
17:46
Просмотров 40 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 85 тыс.
Diagnose slow Python code. (Feat. async/await)
9:57
Просмотров 211 тыс.
#慧慧很努力#家庭搞笑#生活#亲子#记录
00:11