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 слични објави

Пребарај: #nuland

当前筛选 #nuland清除筛选
BadVolf

@BadvolfNews · Post #546 · 28.02.2023 г., 09:50

🇫🇷Victoria Nuland knew about the far right militias in Ukraine, but concealed the fact - French report. A bloodthirsty regime change initiator, the deaths of many hundreds of thousands started with her 'cookies in Kiev' moment. #Nuland#Ukraine Share and subscribe to American Majority

BadVolf

@BadvolfNews · Post #83 · 19.05.2022 г., 15:11

🇺🇸Actually, that is a really interesting video. Remember how during Senate testimony, Biden and Obama official Victoria Nuland admitted there were biological research labs in Ukraine? Victoria Nuland told Senator Marco Rubio: “Ukraine has biological research facilities which we are now quite concerned Russian troops, Russian forces may be seeking to gain control of.” Nuland said so under oath. Why didn’t Victoria "cookies of freedom" Nuland just say there aren’t any bioweapons? Hint: there are bioweapons. If she would have lied, she would go to jail. So just look, what we have. Here's another document we got from our whistleblower. Read it carefully. So there's a reason why Blinken literally stops her from visiting Russia and answering their questions. Ms. Nuland needs to be questioned again, but this time by a Special Counsel and under the penalty of perjury. Russia and China want their questions to be answered too! #Ukraine#bioweapon#biolab#Nuland Share and subsribe @american_majority

BadVolf

@BadvolfNews · Post #97 · 25.05.2022 г., 20:00

⚡BREAKING⚡ 🇺🇸🇺🇦Nuland-Pyatt Tape Removed From YouTube After 8 Years The smoking gun proving U.S. involvement in the 2014 coup in Kiev has been removed from YouTube after eight years, Consortium news reported. The removal of a video happend just a few days later after the American majority channel published another leaked letter from Nuland's office and this proves its authenticity. It was the most complete version of the leaked conversation between then Assistant Secretary of State Victoria Nuland and Geoffrey Pyatt, the then U.S. ambassador to Ukraine, in which the two discuss who will make up the new government weeks before democratically-elected Ukrainian President Viktor Yanukovych was overthrown in a violent coup on Feb. 21, 2014. The U.S. State Department never denied the authenticity of the video, and even issued an apology to the European Union after Nuland is heard on the tape saying, “Fuck the E.U.” SMELL THE PANIC #Ukraine#bioweapon#biolab#Nuland#leak Share and subsribe @american_majority

The New Southerner

@american_majority · Post #121 · 25.05.2022 г., 20:17

⚡BREAKING⚡ 🇺🇸🇺🇦Nuland-Pyatt Tape Removed From YouTube After 8 Years The smoking gun proving U.S. involvement in the 2014 coup in Kiev has been removed from YouTube after eight years, Consortium news reported. The removal of a video happend just a few days later after the American majority channel published another leaked letter from Nuland's office and this proves its authenticity. It was the most complete version of the leaked conversation between then Assistant Secretary of State Victoria Nuland and Geoffrey Pyatt, the then U.S. ambassador to Ukraine, in which the two discuss who will make up the new government weeks before democratically-elected Ukrainian President Viktor Yanukovych was overthrown in a violent coup on Feb. 21, 2014. The U.S. State Department never denied the authenticity of the video, and even issued an apology to the European Union after Nuland is heard on the tape saying, “Fuck the E.U.” SMELL THE PANIC #Ukraine#bioweapon#biolab#Nuland#leak Share and subsribe @american_majority