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

Резултати

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

Пребарај: #custody

当前筛选 #custody清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4126 · 11.02.2025 г., 22:00

BitGo Considers IPO in 2025 Crypto custodian BitGo Inc. is exploring an IPO, potentially listing in H2 2025 amid positive regulatory climate. The company raised $100 million in 2023, increasing its valuation to $1.75 billion. This move aligns with growing institutional interest in crypto. Read more: Bloomberg #Crypto#IPO#BitGo#Blockchain#Investment#MSTR#Profit#Custody#Regulation#Market#Financial#Valuation#Institutional#Assets#Saylor#Trading#News#Tech#Finance#VC

Venture Village Wall 🦄

@venturevillagewall · Post #4078 · 05.02.2025 г., 22:00

Massive Crypto Transfers and Bitcoin News 🚨 A staggering 50 billion #HEX ($104 million) moved between unknown wallets. Read more on Whale Alert. ⏳ On another note, Utah will become the first U.S. state to create a Bitcoin Reserve, investing up to 5% of state funds in $BTC and altcoins, potentially setting a precedent nationwide. 📊 Bitcoin's annual volatility is at an all-time low, with superior risk-adjusted returns compared to major asset classes as reported by ARK Invest. Meanwhile, the total Stablecoin supply on Base has surpassed $4B (source). Plus, banks are lobbying for crypto custody opportunities, while over 5,100 #BTC ($497 million) was transferred from #Kraken to an unknown wallet. Ark Invest also confirms Bitcoin's trajectory toward its 2030 price targets. 🌐 #HEX#Bitcoin#BTC#Kraken#Stablecoin#Crypto#Finance#Investments#ARKInvest#DeFi#Utah#Volatility#PriceTargets#WhaleAlert#Custody#CryptoAssets#Onchain#Investing#MarketTrends#Ethereum

Venture Village Wall 🦄

@venturevillagewall · Post #4335 · 08.03.2025 г., 01:00

Coinbase Expands Listings Amid Positive Crypto News Coinbase adds Aethir (ATH) and Syrup (SYRUP) to listing roadmap. Aethir is a decentralized yield aggregator; Syrup enhances institutional digital asset lending. In related news, Gemini, the crypto firm of the Winklevoss twins, confidentially files for IPO with Goldman Sachs, Citigroup support; public offering may happen this year. Additionally, the top US banking regulator rescinds digital asset restrictions, allowing banks to engage in crypto custody and stablecoin activities. Trump's administration pursuing strategies to increase U.S. Bitcoin reserves. #Coinbase#Aethir#Syrup#Gemini#IPO#Winklevoss#Crypto#Bitcoin#Finance#Regulation#US#Banking#Custody#Stablecoins#DigitalAssets#DeFi#VC#Trump#CryptoNews#MarketUpdates

Venture Village Wall 🦄

@venturevillagewall · Post #4153 · 14.02.2025 г., 19:00

Citi Eyes Crypto Custody Expansion Citi is considering the addition of crypto custody services, indicating a growing interest in the digital asset space. Meanwhile, 60,045,505 #XRP, valued at 163,660,947 USD, was recently transferred between unknown wallets, according to Whale Alert. Read more: BBG #Citi#Crypto#XRP#Custody#WhaleAlert#Finance#DigitalAssets#Banking#Investment#Assets#Blockchain#Wallets#Market#News#Updates#FinanceNews#FinanceTech#WealthManagement#CustodyServices#DigitalCurrency

Venture Village Wall 🦄

@venturevillagewall · Post #4187 · 19.02.2025 г., 04:00

Crypto-Friendly Lutnick Confirmed as Commerce Secretary The US Senate has confirmed Howard Lutnick as Secretary of Commerce, known for his pro-crypto stance. In related news, State Street and Citi, two major banks, are both entering the cryptocurrency custody business, with State Street planning to launch services next year. State Street manages $46.6 trillion while Citi holds $25 trillion in custody assets. Read more here and further details on custody here. #Crypto#Commerce#Banking#Custody#HowardLutnick#StateStreet#Citi#Finance#Assets#Investment#DigitalAssets#BitCoin#CustodianServices#Blockchain#Senate#Regulation#USPolitics#Cryptocurrency#Innovation#CryptoNews

Venture Village Wall 🦄

@venturevillagewall · Post #3835 · 10.01.2025 г., 04:00

Russia to Sell Seized Bitcoin Assets The Russian Ministry of Finance plans to sell seized Bitcoin assets from the Infraud hacking case, starting with a batch valued at approximately $10 million. Marat Tambiev, a corrupt official, previously obtained 1,032.1 BTC from the hacker group. Read more here. #Bitcoin#Russia#Infraud#Crypto#DigitalAssets#Banking#Finance#Regulation#MiCA#Custody#StandardChartered#EU#Hacking#Seizure#MaratTambiev#CryptoNews#BTC#Blockchain#FinanceNews#News

Venture Village Wall 🦄

@venturevillagewall · Post #4192 · 19.02.2025 г., 16:00

Hong Kong Targets Global Virtual Asset Hub Hong Kong unveils new roadmap to become a global virtual asset center, focusing on staking services, attracting liquidity, and exploring derivatives trading. Further endeavors include OTC and custody licensing. For details, visit Wu Blockchain News. #HongKong#VirtualAssets#Crypto#DeFi#Liquidity#Licensing#Staking#Derivatives#OTC#Custody#Regulation#Finance#Investment#Blockchain#Web3#MarketTrends#TechUpdates#Innovation#GlobalMarkets#FutureOfFinance