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
I made pip startup 25% faster (intermediate) anthony explains #427
12:30
anthonywritescode
Рет қаралды 2,2 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Real 10x Programmers Are SLOW To Write Code
14:51
Thriving Technologist
Рет қаралды 71 М.
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,6 МЛН
What React Refs Can Do for You
17:56
React Conferences by GitNation
Рет қаралды 7 М.
your tests should have 100% coverage
18:56
anthonywritescode
Рет қаралды 6 М.
Ranking Java Features Added from Versions 8 to 21!
27:03
Tales from the jar side
Рет қаралды 12 М.
unconventional uses of dumb-init
7:03
anthonywritescode
Рет қаралды 2,3 М.
Choose the Right Option
18:14
Logan Smith
Рет қаралды 80 М.
why don't signals work in docker?
12:30
anthonywritescode
Рет қаралды 6 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН