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

Пребарај: #celia

当前筛选 #celia清除筛选
Celia

@celiaexchange · Post #643 · 03.04.2025 г., 09:20

🚀 Celia Token Claiming Just Got Easier!🔥 Celia Family, we heard your feedback, and we’ve made the claiming process even simpler! You can now claim your unclaimed CELIA tokens directly at 👉https://celia.ltd/claim by just providing your registered email address—no need for a claim address! ✅ If you qualify for on-chain claiming, you can get your tokens immediately. ✅ If not, don’t worry! You’ll still be able to claim directly in the new Celia app launching in the 2nd week of this month. We remain steadfast in keeping to our timelines, ensuring no one is left behind in the Celia ecosystem. 🚀 Your tokens are waiting—go claim them now! 🔥 #Celia#Crypto#Blockchain#Web3

Celia

@celiaexchange · Post #642 · 01.04.2025 г., 10:15

🌍 Celia Speaks Your Language! 🌍 We’re thrilled to introduce 30 of the world’s most spoken languages into the Celia app (launching mid-April), now live on our website, and soon across all ecosystem products! 🎉🗣️ These languages are spoken by over 7.34 billion people, reinforcing our belief that while we may be divided by language, we are united in building something great with Celia. 🚀🔥 But we’re not stopping here— more languages will be added as we roll out new ecosystem products in the coming months. Your voice matters! 💪 🌎 Celia is global. Celia is for everyone. 🌎 🔽 Rep your language in the comments! 🔽🏁📢#Celia#CryptoForEveryone#Web3

Celia

@celiaexchange · Post #988 · 13.05.2026 г., 07:38

Who said crypto can't be fun? 👀🎮 Play games on Celia Wallet. Climb the leaderboard. Earn real rewards in $CELIA & $USDT every single week. 🏆 Top 10 players get PAID weekly, no cap. And guess what? More games are dropping soon 👀🔥 We're not just a wallet. We're making crypto fun while you trade 💸 Your move 👇 Download Celia and start playing. https://onelink.to/g6bbq8 #CeliaWallet#PlayToEarn#CryptoGaming#Web3#USDT#CELIA

Airdrop Center

@centralchanel · Post #15821 · 04.01.2025 г., 20:20

January Listing 🔥 ✅#Nodepay: 6 January ✅#MomoAi: 6 January ✅#Xterio: 8 January ✅#Sidekick : 8 January ✅ $Vertus :13 January ✅#Seed : 15 January ✅#Xcoin : 20 January ✅#Tapswap : 23 January ✅#Wcoin : 25 January ✅#CommunityGaming : 28 January Unofficial Listing ✅#PAWS ✅#UXUY ✅#Yuligo ✅#MemeWar ✅#DuckChain ✅#Celia Stay connected