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

Резултати

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

Пребарај: #genocide

当前筛选 #genocide清除筛选
Freedom Flotilla Coalition

@FFC_official_channel · Post #571 · 03.07.2025 г., 18:48

"‘We Need More Angry Young Women’ To End Israeli #Genocide Of #Gaza... And Fewer Angry, Old, White Politicians." Climate Activist and Gaza #FreedomFlotilla volunteer Greta Thunberg’s response to Trump’s assertion that she needs anger management. By Ann Wright, in Popular Resistance. https://popularresistance.org/we-need-more-angry-young-women-to-end-israeli-genocide-of-gaza/

Savino Balzano

@savinobalzano · Post #563 · 14.02.2024 г., 17:00

Quanto accade a Gaza è un GENOCIDIO, condotto da un governo di criminali: mi rendo conto che per il direttore di qualche bollettino (definirlo telegiornale è troppo) sia dura da mandare giù, ma tant'è. I peggiori però sono quelli che oggi parlano di libertà di espressione a rischio: sono gli stessi che ci accusavano di essere fiancheggiatori di Hamas o di essere putiniani. La mia al TG Plus di Cusano Italia TV #genocide#Genocidio#Palestina#guerra#pace https://www.youtube.com/watch?v=MyB-BMQAeIQ&ab_channel=SavinoBalzano

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3869 · 15.01.2025 г., 18:52

After 466 days of #genocide, #Israel and #Hamas agreed to a deal to halt fighting in #Gaza and exchange Israeli hostages for Palestinian prisoners. This deal opens the way to a possible end to a 15-month war that has upended the Middle East. The agreement follows months of on-off negotiations brokered by Egyptian and Qatari mediators, with the backing of the United States, and came just ahead of the Jan. 20 inauguration of U.S. President-elect Donald Trump.

Hidden In Plain Sight

@hiddeninplainsight1 · Post #24083 · 20.03.2026 г., 06:16

☠️💀 While Bovaer is front and centre atm we need to also ask our dairy and meat suppliers if they are using RUMIN8 on their cattle...... Check out what RUMIN8 really is.....😳🙄🧐 Highly toxic to animals and humans....😡🤨 #climatechangehoax#depopulation#genocide https://t.me/hiddeninplainsight1

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3143 · 28.08.2024 г., 15:50

Herzi Halevi, the Chief of Staff of the Israeli Occupation Forces, visits the frontlines of the military operation in the #WestBank, stating, "We are here for Israel's security." Tell us again how this is NOT a #Genocide And point to us wehre the HELL is #Hamas in the West Bank you genocidaires.

CulturalExile

@CulturalExile14 · Post #3792 · 11.12.2022 г., 16:08

Another sign of the intentional destruction of civilisation. In 2024 Trafalgar Square's Fourth Plinth will be surrounded by the casts of 850 tranny prozzies!! A monstrosity created by Mexico's answer to Yoko Ono, the smokescreen tranny agenda keeps the #paedophilia, #transhumanism and #genocide trains chugging. https://artsandculture.google.com/story/850-improntas-850-imprints-mayor-of-london/VQWhmzmLR4DD5Q?hl=en https://youtu.be/3CIuRLfmNuI

ПретходнаСтраница 1 од 4Следна