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

Резултати

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

Пребарај: #shanghai

当前筛选 #shanghai清除筛选
SpotOnChain | Announcement

@spotonchain · Post #163 · 12.04.2023 г., 19:24

🚨🚨 A whale, likely BlockTower capital, just moved 5,989 $ETH ($11.4M) to Coinbase, Deribit and Kraken an hour ago. ➡️ The action is right before the #Shanghai upgrade (which is in about 3 hours) ➡️ The whale also moved 2,630 ETH ($5M) two days ago to Coinbase Will we see the dump after #Shanghai🤔🤔? Address link: https://etherscan.io/address/0x43adde52c6c142912662d3e427709db5cac9b811

Hashtags

SpotOnChain | Announcement

@spotonchain · Post #161 · 12.04.2023 г., 02:03

🔥🔥#Shanghai upgrade is less than 24 hours ➡️ It happens at block 194,048 ➡️ Estimated time: 10:30PM UTC 12 Apr 2023 Do check out the important stats in our previous tweet https://twitter.com/spotonchain/status/1643640198222454785?s=20

Hashtags

SpotOnChain | Announcement

@spotonchain · Post #154 · 09.04.2023 г., 03:16

🚨 A whale "peedan.eth" just swapped 627.084K $LDOto 1.46M $CRV ($1.5M) 8 hours ago. ➡️ The average swapping price was $2.4 per $LDO and $1.05 per $CRV ➡️ With this action, he cleared off all of the $LDO right before #Shanghai upgrade 🤔 ➡️ For the above swap, he converted 168K $LDO directly to $CRV and the rest was swapped to $ETH before swapping to $CRV ➡️ Those $LDO was accumulated using 368 $stETH and 467 $WETH (~$1.5M) at $2.4 per $LDO on Apr 02 His Address: 0x509984Bfc0fb24E2d1377CFec224d3AfEc4c341E

Hashtags

SpotOnChain | Announcement

@spotonchain · Post #166 · 14.04.2023 г., 03:28

🌟🌟🌟 Wallet 0xA03D (likely @ambergroup_io) received 500K $LDO at $2.32 (~$1.16M) from #Binance right before #Shanghai upgrade on Apr 12. 💰With the recent pump ($LDO price 🔼 ~11%), the unrealized profit for this trade is $110K. ✅ Amber mostly accumulated $LDO at low (in late 2022) & appears to be strong holder. 👉 More details about Amber’s $LDO trading history and profits: https://twitter.com/spotonchain/status/1646714234468970497

SpotOnChain | Announcement

@spotonchain · Post #150 · 06.04.2023 г., 06:35

🔥 Some VC and KOL recently resumed their $LDO activities ahead of the upcoming #Shanghai upgrade! 🔥 ⭐️Dragonfly Capital kept on moving another 191K $LDO at $2.56 (~$495K) to #Binance 10 hours ago ✅ They used to transfer 2M $LDO to OKX at $2.33 (~$4.67M) on Mar 23 ✅ Their average buying price was at $1.6 ✅ Still hold 20.95M $LDO ~ $53.2M across 4 wallets ⭐️Rune (founder of MakerDao) restarted to swap 153K $LDO for 570 $MKR and 4.2 $WETH 14 hrs ago ✅ No new $LDO were purchased. Just received back 1.2M $LDO that he temporarily moved out to a middle wallet. ✅ The last $LDO-$MKR swapping happened on Mar 17 (19 days ago) Addresses: Dragonfly: 0x7D68a49754c55f1fB410F535f2b82a16f64481b6 RuneKek: 0x0f89D54B02ca570dE82F770D33c7B7Cf7b3C3394

allanesta_film

@allanesta_film · Post #229 · 01.10.2025 г., 19:57

Папоротник 🌿 📎 261 📆 07_2025 🗺 Павлово на Оке, Нижегородская область 📷 Olympus OM-1/ Seikanon MC 28/2.8 🎞 SHANGHAI Color film 400 🧪 C41 📌 iso 400 P.S. привет октябрь #olympusom1 #shanghai

Hayat Estate на выставке в Китае Эти три дня стали невероятно насыщенными: 🤝 Мы встретились с интересными людьми, 💬 Пообщались с партнёрами и посетителями, 🌏 Открыли новые возможности! Шанхай, спасибо за вдохновение и теплый приём! #Shanghai#Выставка2024

SpotOnChain | Announcement

@spotonchain · Post #70 · 01.03.2023 г., 12:14

🔥🔥$RPL may be one of the #LSD narrative leaders amid the #Shanghai upgrade hype! ✅ Backed by @Rocket_Pool, highly decentralized LSD's with 1.9K different nodes. ✅ ​​Reached $1B in TVL in less than 2 yrs ✅ Price x2.4 since 2023 ($19.9 -> $48.4) ✅ Strong early investors & VCs 👉More details: https://twitter.com/spotonchain/status/1630903801099038726

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