how I made my import sorter 7x faster (intermediate) anthony explains

  Рет қаралды 3,585

anthonywritescode

anthonywritescode

Күн бұрын

Пікірлер: 22
@tobb10001
@tobb10001 2 жыл бұрын
How can dead code be slow? I thought dead code was code, that cannot be reached and thus never runs. How would code that never runs slow down anything else but compiling?
@anthonywritescode
@anthonywritescode 2 жыл бұрын
the branch is never taken, but the condition is still evaluated every time
@davititchanturia
@davititchanturia 2 жыл бұрын
code runs in 0.0001 anthony : needs optimising
@clementrobert8635
@clementrobert8635 2 жыл бұрын
You said there would eventually be a C implementation of the tokenize module. Do you know where I can learn more about this ? (I couldn't find any PEP or relevant discussion)
@anthonywritescode
@anthonywritescode 2 жыл бұрын
there's no PEP because it's just exposed privately -- github.com/python/cpython/blob/aa37ffda29ac48fb2df5a7029ba2e626ecc45850/Lib/tokenize.py#L685-L690
@ArielVolovik
@ArielVolovik 2 жыл бұрын
Why wasn't it possible to cache classify_base in the original third party package. Why is it a breaking change?
@anthonywritescode
@anthonywritescode 2 жыл бұрын
mutable inputs
@ArielVolovik
@ArielVolovik 2 жыл бұрын
@@anthonywritescode oh - I thought lru_cache would cache the return of the function as long as the input params to the function are the same. So it would handle different inputs just fine
@anthonywritescode
@anthonywritescode 2 жыл бұрын
that is exactly how it works yes, but how do you know when inputs are "different"?
@ArielVolovik
@ArielVolovik 2 жыл бұрын
@@anthonywritescode I thought it had a mapping of the form {input1: result1, input2: result2, ...} "under the hood"
@anthonywritescode
@anthonywritescode 2 жыл бұрын
and say you had a cached function `f` you call it once: ``` x = [1, 2, 3] f(x) ``` and then you run ``` x.append(4) f(x) ``` what should the cache do? (I think I go over this in more detail in kzbin.info/www/bejne/gWG0Zqetqb6rjbs )
@akshaymestry7503
@akshaymestry7503 2 жыл бұрын
Anthony, dude... you gotta share the theme file with us man! The theme looks so OP!
@anthonywritescode
@anthonywritescode 2 жыл бұрын
I think it's "gruvbox hard" not sure though -- it was set by twitch chat
@alexeyzhurov7747
@alexeyzhurov7747 2 жыл бұрын
Anthony: 0.1s delay is too much, needs optimization. Legacy code in my project: change this string and it will be 4 seconds faster :)
@adwaith-rajesh
@adwaith-rajesh 2 жыл бұрын
whats the theme 🌝
@anthonywritescode
@anthonywritescode 2 жыл бұрын
I think it's "gruvbox hard" not sure though -- it was set by twitch chat
@ericng8807
@ericng8807 2 жыл бұрын
"how I made my import sorter BLAZINGLY FASTer (intermediate)"
@sq546
@sq546 2 жыл бұрын
is it 5 or 7? waaah
@anthonywritescode
@anthonywritescode 2 жыл бұрын
it's 7 -- see the description!
@chp3226
@chp3226 2 жыл бұрын
fr
your tests should have 100% coverage
18:56
anthonywritescode
Рет қаралды 6 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
How I animate 3Blue1Brown | A Manim demo with Ben Sparks
53:41
3Blue1Brown
Рет қаралды 1,3 МЛН
debugging and fixing pyuwsgi in python 3.12 (advanced) anthony explains #580
1:00:01
unconventional uses of dumb-init
7:03
anthonywritescode
Рет қаралды 2,3 М.
Just enough assembly to blow your mind
29:31
Kay Lack
Рет қаралды 160 М.
debugging a broken cache!
21:16
anthonywritescode
Рет қаралды 5 М.
why don't signals work in docker?
12:30
anthonywritescode
Рет қаралды 6 М.
Where Does Bad Code Come From?
42:21
Molly Rocket
Рет қаралды 211 М.
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 88 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН