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?
@anthonywritescode2 жыл бұрын
the branch is never taken, but the condition is still evaluated every time
@davititchanturia2 жыл бұрын
code runs in 0.0001 anthony : needs optimising
@clementrobert86352 жыл бұрын
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)
@anthonywritescode2 жыл бұрын
there's no PEP because it's just exposed privately -- github.com/python/cpython/blob/aa37ffda29ac48fb2df5a7029ba2e626ecc45850/Lib/tokenize.py#L685-L690
@ArielVolovik2 жыл бұрын
Why wasn't it possible to cache classify_base in the original third party package. Why is it a breaking change?
@anthonywritescode2 жыл бұрын
mutable inputs
@ArielVolovik2 жыл бұрын
@@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
@anthonywritescode2 жыл бұрын
that is exactly how it works yes, but how do you know when inputs are "different"?
@ArielVolovik2 жыл бұрын
@@anthonywritescode I thought it had a mapping of the form {input1: result1, input2: result2, ...} "under the hood"
@anthonywritescode2 жыл бұрын
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 )
@akshaymestry75032 жыл бұрын
Anthony, dude... you gotta share the theme file with us man! The theme looks so OP!
@anthonywritescode2 жыл бұрын
I think it's "gruvbox hard" not sure though -- it was set by twitch chat
@alexeyzhurov77472 жыл бұрын
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-rajesh2 жыл бұрын
whats the theme 🌝
@anthonywritescode2 жыл бұрын
I think it's "gruvbox hard" not sure though -- it was set by twitch chat
@ericng88072 жыл бұрын
"how I made my import sorter BLAZINGLY FASTer (intermediate)"