TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #32 · 7 фев.

Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять: from timeit import timeit def t1(): # складываем 10 строк через + из переменной t = 'text' for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t2(): # склеиваем список строк через метод join arr = ['text'] * 10 for _ in range(1000): s = ''.join(arr) def t3(): # складываем через + но не из переменной а непосредственно инлайн объекты for _ in range(1000): s = 'text' + 'text' + 'text' + ... # всего 10 раз Теперь каждую строку склейки запустим по 10М раз >>> timeit(t1, number=10000) 0.21951690399964718 >>> timeit(t2, number=10000) 1.4978306379998685 >>> timeit(t3, number=10000) 0.2213820789993406 Хм, а нам говорили что через "+" это плохо и медленно ))) 😁 Тут стоит учитывать, что речь идёт о склейке множества длинных строк. Давайте изменим условия: def t4(): t = 'text'*100 for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t5(): arr = ['text'*100] * 10 for _ in range(1000): s = ''.join(arr) def t6(): for _ in range(1000): s = 'text'*100 + 'text'*100 + ... # всего 10 раз >>> timeit(t4, number=10000) 12.795130728000004 >>> timeit(t5, number=10000) 2.642637542999182 >>> timeit(t6, number=10000) 0.2184546610005782 Вот, уже другой разговор, сразу видна разница, в среднем в 6 раз. Но погодите, почему последний тест t6() по скорости такой же как и t3()? Ведь строки теперь в 100 раз длиннее! Это вопросы оптимизации кода, какие простые изменения ускоряют или замедляют выполнение программы. Мы столкнулись с примером обхода обращения к переменной. Например, именно так работает директива #define в С++, во время компиляции подставляя значение переменной вместо ссылки на неё. В Python это тоже работает, но часто ли вы сможете встретить такой способ работы со строками? К сожалению, способ почти только теоретический. В целом, тесты показали то, что мы хотели. Делаем выводы самостоятельно. Полный листинг 🌍 #tricks

Резултати

Пронајдени 4 слични објави

Пребарај: #sylviamiami

当前筛选 #sylviamiami清除筛选

Post 🇫🇷 & 🇺🇸 🇫🇷🚨📣 Mike Pompeo APPLAUDI pour avoir demandé que les livres d’histoire ne parlent pas des victimes de Gaza…👀🤔 L'ancien secrétaire d'État américain Mike Pompeo a déclaré, lors d'une conférence pro-israélienne, qu'il fallait veiller à ce que les livres d'histoire "ne parlent pas des victimes de Gaza". Applaudi par l'audience, il a affirmé que les "véritables victimes" étaient les Israéliens. 🟢 Rappel - La Floride sous Influence Étrangère… 👉https://t.me/sylviamiamiofficiel/5377 🇺🇸🚨📣 Mike Pompeo APPLAUDED for asking that history books not speak about the victims of Gaza… 👀🤔…()…👇 📍Source 👉 nouvelleaubefr ♦️sur X 👉 https://x.com/sylviamiami1776/status/2011514042397941874?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami

Hashtags

Post 🇫🇷 & 🇺🇸 🇫🇷🚨📣 Epstein Files : le nom de Madeleine McCann apparaît 🥹…👇 Le nom de la petite Madeleine McCann apparaît dans les documents de l’affaire Epstein concernant Ghislaine Maxwell, « l’associée d’Epstein ». Quand Madeleine a disparu en 2007 au Portugal, un portrait-robot de suspect montrait une femme ressemblant fortement à Ghislaine Maxwell. Selon les fichiers Epstein, en septembre 2009, Ghislaine Maxwell aurait été vue avec une enfant correspondant à la description de Madeleine, deux ans après sa disparition… 🇺🇸🚨📣 Epstein Files: The name of Madeleine McCann appears 🥹…👇 📍 Source Emelia Rjl ♦️ Post sur X 👉 https://x.com/sylviamiami1776/status/2022622365281091796?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami #EpsteinFiles#MadeleineMcCann

🥹🚨📣 Olivier Ferrand (97 % de son corps brûlé à 9 ans), alias Captain Icarus, inspire et conseille les victimes de brûlures, dont celles de Crans-Montana. Faites passer son message 🙏🕊️ #cransmontana#brulure#aide#réveillon#incendie 📌association burns and smiles 📌association des brûlés de France 📌flavie association ♦️ Post sur X ➡️ https://x.com/sylviamiami1776/status/2008463123145969800?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami

🍑🍆😍PÉDO-CRIMINALITÉ💗👶🔞 ET SI LA VÉRITÉ LA PLUS SOMBRE SE CACHAIT SOUS NOS PIEDS ? 3 juin 2025 Post 🇫🇷 & 🇺🇸 🇫🇷🚨📣 Les nouveaux documents déclassifiés de l’affaire Epstein révèlent que, je cite : « des suprémacistes juifs comme Epstein nous considèrent comme du bétail, des Goyim nés uniquement pour les servir. » 🎥 ÉCOUTEZ avec attention cette courte vidéo jusqu’au bout👀🔥 🇺🇸🚨📣 The newly declassified documents from the Epstein case reveal, I quote: “Jewish supremacists like Epstein see us as cattle Goyim who are born only to serve them.” 🎥 WATCH this short video carefully until the end 👀🔥 📍Source KagDrogo ♦️ sur X ➡️ https://x.com/sylviamiami1776/status/2018620480240996560?s=46&t=sxY0HSCpYKEdPDgmFgbPCQ 🇺🇸🦅🇫🇷 Sylvia Miami 👉linkmix.co/20609370 #SylviaMiami #Trump#Epstein #Rothschilds #JPMorgan#BlackRock #Ukraine#Goyim