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

Резултати

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

Пребарај: #nodepay

当前筛选 #nodepay清除筛选
Airdrop Gold : Crypto Airdrop

@airdropgoldchannel · Post #157512 · 09.09.2024 г., 18:31

⭐️#Nodepay Airdrop: Learn To ai And Earn #Airdrop 1. Register At NodePay 2. download the chrome extension in. pc/android (kiwi/mises browser) 3. login with your account 4. Browse Internet to earn 5.Enjoy @AirdropGoldChannel

Crypto Profits Hub

@Futurentry · Post #4205 · 26.12.2024 г., 18:40

NodePay Airdrop Listing Date: Latest 2024 Release Details Discover when NodePay airdrop listing date will be announced and stay updated on this promising DeFi project's token distribution and exchange availability in 2024 Contact admin if you have any questions : @Riley_Fe #airdrops#bitcoin#blockchain#crypto#Nodepay#technology

Crypto Profits Hub

@Futurentry · Post #4180 · 24.12.2024 г., 16:40

When Will New Nodepay Listing Date Be Announced? Discover when Nodepay listing date will be announced and learn about this innovative payment platform's journey toward public trading. Stay updated on market entrance details Contact admin if you have any questions : @Riley_Fe #airdrops#bitcoin#blockchain#crypto#Nodepay#technology

Crypto Profits Hub

@Futurentry · Post #4164 · 23.12.2024 г., 08:46

NodePay Airdrop Date: New Token Distribution Info Stay informed about the nodepay airdrop date and distribution schedule. Get essential details on eligibility criteria, token allocation, and how to participate in this upcoming crypto event Contact admin if you have any questions : @Riley_Fe #airdrops#bitcoin#blockchain#crypto#Nodepay#technology

Crypto Profits Hub

@Futurentry · Post #4129 · 20.12.2024 г., 10:43

NodePay Airdrop: Claim Free Crypto Rewards Now Join the NodePay airdrop and earn free crypto rewards by participating in simple tasks. Get your share of tokens by completing social media activities and community engagement Contact admin if you have any questions : @Riley_Fe #airdrops#bitcoin#blockchain#crypto#Nodepay#technology

Crypto Profits Hub

@Futurentry · Post #4193 · 25.12.2024 г., 18:45

NodePay Airdrop Listing Date: New Upcoming 2024 Stay updated on the nodepay airdrop listing date and upcoming schedule for 2024. Get ready to participate in this highly anticipated token distribution event and secure your rewards Contact admin if you have any questions : @Riley_Fe #airdrops#blockchain#crypto#defi#Nodepay#technology

Venture Village Wall 🦄

@venturevillagewall · Post #3731 · 27.12.2024 г., 19:00

AI Startups Secure Major Funding Deals 🚀 1. Inferix: Decentralized GPU network raising $2.60M led by DePIN X. 2. PoSciDonDAO: Receives undisclosed funding from BoostVC for personalized medicine. 3. Skynet: Autonomous AI agent protocol secures $1.20M in Pre-seed funding. 4. Nodepay: AI training decentralized network raises $7M, led by IDG Capital and MVP. 5. The Grid: Web3 metadata directory collects $624K in Angel funding. For more on the funding rounds: source #AI#Funding#Inferix#PoSciDonDAO#Skynet#Nodepay#TheGrid#DeFi#Crypto#VC

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