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

Резултати

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

Пребарај: #terawulf

当前筛选 #terawulf清除筛选
NEWS 鏈新聞-ABMedia

@abmedia_news · Post #24473 · 09.05.2026 г., 02:26

【₿ 比特幣|TeraWulf Q1:HPC 收入首度超越比特幣挖礦、虧 4.28 億美元、Hawesville 收購 3 億】 TeraWulf 5/8 公布 Q1 財報:HPC 租約收入 2,100 萬美元(占 62%)首次超越比特幣挖礦、來自 Core42 長期合約。總營收 3,400 萬美元、淨虧 4.276 億美元(主因為非現金 warrant 重評價 + 利息費用)。本季完成 Hawesville 場地收購 3.019 億美元、現金部位 30.9 億美元。延續 Hut 8/Core Scientific 礦業轉 AI 系列。 #TeraWulf#Core42#AI算力 📍閱讀全文: https://abmedia.io/terawulf-q1-2026-hpc-revenue-exceeds-bitcoin-mining-may-2026

Venture Village Wall 🦄

@venturevillagewall · Post #3706 · 24.12.2024 г., 19:00

Crypto Predictions for 2025 Revealed 🚀 *Forbes* outlines key predictions for the crypto industry by 2025:* 🔹 G7 or BRICS nation to announce strategic Bitcoin reserve, following Trump’s remarks. 🔹 Stablecoin market cap projected to hit $400 billion due to regulatory clarity, bolstering the USD. 🔹 Bitcoin DeFi will drive growth with L2 solutions like Stacks and Babylon aiming for $24 billion TVL. 🔹 New ETFs incoming, including Ethereum with staking, Solana, and diversified crypto indices. 🔹 Major corporations like Apple or Google may add Bitcoin to their balance sheets. 🔹 Overall crypto market forecast to exceed $8 trillion, fueled by DeFi, AI, and DePIN. 🔹 Revitalization of U.S. crypto startups expected as regulatory changes ease access. 👉 Explore more: Crypto Twitter 🌐Related Links: - Mining Ban in Parts of Russia - MicroStrategy Considers Stock Increases for Bitcoin Purchases - New Scam Alert Regarding YouTube Seed Phrases - Forbes Full Crypto Industry Predictions - Christmas Rally for Bitcoin Fizzles - Nokia Patents New Asset Encryption Module - Cyber Threats from NK Causing $249M Outflow from Hyperliquid - Bullish Ethereum Forecast by Analyst - TeraWulf Allocates 70MW for AI Computing - Investors Pull $1.18B from Bitcoin ETFs - BNB Chain DeFi Ecosystem Grows 58% - S-Group Creators Arrested for $100M Fraud - Black Sea Resident Scammed on Bitcoin Purchase - Meme Coin Boom Attracts Fraudsters to Solana - SpaceX Utilizes Stablecoins for Currency Risk Hedging #Crypto#Bitcoin#DeFi#ETF#Stablecoins#MarketCap#G7#BRICS#Investment#AI#Regulation#Technology#MicroStrategy#Nokia#CyberThreats#MemeCoins#Scam#TeraWulf#BNBChain#Solana#SpaceX