@bizfeed · Post #332460 · 14.08.2025 г., 22:39
DL News | News Feed | ꘜ Crypto exchanges should block users from cashing out tokens with low ‘compliance scores,’ BIS researchers say ~ ₿izFeed#⃣:#cryptonews
Hashtags
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
Пребарај: #cryptonews
@bizfeed · Post #332460 · 14.08.2025 г., 22:39
DL News | News Feed | ꘜ Crypto exchanges should block users from cashing out tokens with low ‘compliance scores,’ BIS researchers say ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332448 · 14.08.2025 г., 21:18
The Block | 𝕏 David Bailey’s Nakamoto and KindlyMD close merger for Bitcoin treasury ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332447 · 14.08.2025 г., 21:14
unfolded. | ꘜ Long-term holders still command ~85% of all Bitcoin—near a historic high—while net outflows continue to drain exchange inventories, creating an increasingly illiquid float that can magnify price moves — link | AI comment ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332446 · 14.08.2025 г., 20:39
Blockworks | ꘜ Charting the course 📊 https://blockworks.co/news/the-state-of-solana-charts ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332445 · 14.08.2025 г., 20:39
The Block | 𝕏 US Justice Department unseals warrant to seize millions in crypto from alleged ransomeware operator ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332434 · 14.08.2025 г., 20:04
The Block | 𝕏 Bitcoin miner TeraWulf shares jump 50% after Google secures 8% stake as part of $3.7 billion 10-year AI compute deal ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332432 · 14.08.2025 г., 19:44
Blockworks | ꘜ To cut or not to cut...that is the question https://blockworks.co/news/outlining-fed-rate-cut-scenarios ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332429 · 14.08.2025 г., 19:14
The Block | 𝕏 Bitcoin Layer 2 Bitlayer raises additional $5 million in oversubscribed public token rounds on decentralized crowdfunding platforms ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332417 · 14.08.2025 г., 18:54
Blockworks | ꘜ Circle one: - Rollup - L1 https://blockworks.co/news/circle-l1-impact-ethereum ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332416 · 14.08.2025 г., 18:54
DL News | News Feed | ꘜ The US ‘won’t buy’ more Bitcoin, says Treasury Secretary ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332415 · 14.08.2025 г., 18:54
unfolded. | ꘜ Citigroup considers custody and payment services for stablecoins, crypto ETFs — link | AI comment ~ ₿izFeed#⃣:#cryptonews
Hashtags
@bizfeed · Post #332414 · 14.08.2025 г., 18:33
The Block | 𝕏 The Daily: Bessent says govt won't buy bitcoin for strategic reserve, Ethereum ICO whale sells another $5 million in ETH, and more ~ ₿izFeed#⃣:#cryptonews
Hashtags