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

Резултати

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

Пребарај: #bushnell

当前筛选 #bushnell清除筛选
Bushnell's Men

@BushnellMen · Post #191 · 25.03.2026 г., 13:32

Being purchased by Pavlov media incorporation, Velocityonline provides Americans with high speed Internet which has various costumers all around the United States. #USA #bushnell

Bushnell's Men

@BushnellMen · Post #190 · 25.03.2026 г., 12:27

Having sent multiple proofs regarding security breach into printers in US universities, let us inform you of a wide range of US companies famous for Internet services providing and network administration. Dozens of such corporations provide Americans and other nations with high-speed Internet and infrastructure and make quite a lot of money. In a few minutes, proofs and screenshots will be shared with you. Stay in touch with us. 🇵🇸🇵🇸🇵🇸 #USA #bushnell

Bushnell's Men

@BushnellMen · Post #188 · 25.03.2026 г., 06:24

WORCESTER POLYTECHNIC INSTITUTE Our team identified a random printer right there and ... had a little bit of play with it! There are more to share, stay tuned. #bushnell #USA

Bushnell's Men

@BushnellMen · Post #186 · 24.03.2026 г., 12:05

Virginia Tech is a premier public land-grant research university with an emphasis on technology. With over 450 million dollars in research funding, especially in engineering, agriculture, and biotechnology, it is the most comprehensive university in Virginia. Then, it is worth it to wake them up, too. #bushnell #USA

Bushnell's Men

@BushnellMen · Post #175 · 23.03.2026 г., 13:42

Alright, here goes the first wave of printers being hacked by Bushnell's men. Multiple printers started to print particular messages. This is an effort against US censorship campaign and censorship during the unprovoked battle with Iran. To be continued... #bushnell #USA

Bushnell's Men

@BushnellMen · Post #203 · 27.03.2026 г., 08:31

We accessed Xfinity’s print device network to send messages and got an interesting view of their internal operations. It turns out, their infrastructure is more complex than it seems, revealing some lesser-known details about how they handle their service and communication. #bushnell #Xfinity

Bushnell's Men

@BushnellMen · Post #195 · 26.03.2026 г., 16:19

Our team has recently uncovered some interesting developments, and let's just say, we have a few prints from Optimum’s internal systems that are raising some eyebrows. You’d be surprised what can happen when a little bit of exploration is done within the corporate network. #bushnell #Optimum

Bushnell's Men

@BushnellMen · Post #193 · 25.03.2026 г., 14:49

Guess what?! Roaming through American IT market led us to an Israeli company called Netvision. I took the company details from the web. As you can see, Bushnell's poster was on the printing queue three times. And do not forget, while we are watching all these posts, Iranians are getting killed by peace-bringing bombs from above. 💔 #bushnell #Iranwar #Israel

Bushnell's Men

@BushnellMen · Post #180 · 24.03.2026 г., 07:25

Such a pleasure to walk through the nature, but inside Columbia university! Americans have to stay informed and up against this illegal war, a kind of conflict that Netanyahu brought for us and Trump accepted it. Five screenshots as proofs for our beloving subscribers. By the way, we wished for sending any pictures from those baffled people after receiving our posters. 😉 #bushnell #trump #Iranwar #Israel #USA #MAGA

Bushnell's Men

@BushnellMen · Post #160 · 18.03.2026 г., 10:45

We’re back again with Sending files to printers to denounce unnecessary war with Iran on behalf of American people. Numerous U.S. lawmakers, international observers, and advocacy groups have condemned the use of U.S. forces and taxpayers' money to fund what they describe as an "illegal" and "unauthorized," war which lasted for weeks with an undefined goal and conclusion. There is growing pressure to stop the use of U.S. taxpayer money to fund the military operations, with some lawmakers refusing to support supplemental funding for what they term a "disastrous" and "unnecessary" conflict. At least 13 U.S. military personnel have been killed, and Trump warned there will likely be more. #NWWI #NO_War_With_Iran #bushnell #trump #Iranwar #Israel #USA #MAGA #taxpayers