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

Резултати

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

Пребарај: #inflows

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

@venturevillagewall · Post #3434 · 19.12.2024 г., 06:00

Crypto Flow Insights December 19 BTC ETF inflows reached $275.3 million. ETH ETF saw inflows of $2.5 million. Check out more on CryptoTwitter. #BTC#ETH#ETF#Inflows#Crypto#Market#Trends#Investing#Finance#December#News#Updates#Analysis#Data#Assets#Trading#Investments

Venture Village Wall 🦄

@venturevillagewall · Post #3947 · 22.01.2025 г., 07:00

Bitcoin Spot ETF Sees Major Inflows Bitcoin Spot ETF attracts $802M inflow on January 21, boosting total assets to $123.59B. BlackRock's IBIT ETF leads with $662M inflows, marking its fourth consecutive growth day. Ethereum Spot ETF also gains, with $74.43M inflow, primarily driven by BlackRock's ETHA and Grayscale ETFs. For more details, check the full articles: Leviathan News and Wu Blockchain News. #Bitcoin#Ethereum#ETF#BlackRock#Crypto#Investments#Assets#Inflows#Finance#Markets#Trading#TRUMP#OnChain#AssetsManagement#Fund#Wallet#CryptoNews#VC#AI

Venture Village Wall 🦄

@venturevillagewall · Post #4215 · 22.02.2025 г., 07:00

Bitcoin and Ethereum ETF Outflows Report On February 21, Bitcoin spot ETFs saw a net outflow of $62.77M, while BlackRock's ETF IBIT experienced a net inflow of $21.64M. Additionally, Ethereum spot ETFs recorded a net outflow of $8.92M. Read more here. #Bitcoin#Ethereum#ETF#Crypto#Investment#Finance#BlackRock#MarketTrends#Outflows#Inflows#FinanceNews#Blockchain#WuBlockchain#DigitalAssets#SpotETF#Cryptocurrency#Trading#MarketAnalysis#Funds#Assets

Venture Village Wall 🦄

@venturevillagewall · Post #4007 · 28.01.2025 г., 10:00

Metaplanet Plans $745M Bitcoin Purchase Tokyo-listed Metaplanet aims to raise ¥116 billion (approx. $745M) through 21 million share subscriptions at 0% discount for Bitcoin acquisitions. This represents one of the largest financing plans for Bitcoin by any Asian publicly traded company. Detailed info available here: link. Meanwhile, U.S. Bitcoin and Ethereum ETFs received $1.9B in inflows during Trump's first week, bringing total digital asset inflows for 2025 to $4.8B. U.S. Senate also confirmed pro-crypto Scott Bessent as Treasury Secretary, expected to influence crypto regulations amid heightened interest. #Bitcoin#ETF#Crypto#Investment#Metaplanet#Asia#Treasury#DigitalAssets#BTC#ETH#Finance#NASDAQ#WallStreet#MarketTrends#Inflows#Securities#Cryptocurrency#USeconomy#Regulations#Trump#ProCrypto

Venture Village Wall 🦄

@venturevillagewall · Post #3726 · 27.12.2024 г., 07:00

Whales Bring Stablecoins to Exchanges 🔹 After the Christmas crypto market dip, a positive trend emerges as whales deposit stablecoins into exchanges. 🔹 Last 24 hours: 7 deposits of $FDUSD on Binance, each at least $9M; one as high as $50M. 🔹 Deposits linked to new launchpool of Bioprotocol $BIO. 🔹 Large stablecoin deposits indicate whales are gearing up for purchases, potentially boosting market prices. 🔹 Bitcoin spot ETFs halted a 4-day outflow streak with $475M inflow yesterday, while Ethereum funds attracted $117M. More details on whale activity | ETF inflow information #Crypto#Stablecoins#Binance#Whales#Bioprotocol#ETF#Bitcoin#Ethereum#MarketTrends#Investment#Finance#CryptoMarket#Trading#FDUSD#Launchpool#Deposits#Inflows#PriceAction#HODL#VC

Venture Village Wall 🦄

@venturevillagewall · Post #3809 · 07.01.2025 г., 07:00

BTC & ETH ETFs See Massive Inflows 🎄Christmas Update on Crypto ETFs! BTC ETFs had an inflow of $978.6 million, while ETH ETFs attracted $128.7 million. Ex-BitMEX head Arthur Hayes predicts the bullish phase may peak by mid-March, suggesting to increase risk but take profits before April due to upcoming tax and liquidity tightening cycles. Positive dollar momentum is expected to boost liquidity by $612 billion. Key drivers include a decrease in RRP funds and TGA usage by the U.S. Treasury. 🚀 For more details, visit: Wu Blockchain News #Crypto#BTC#ETH#ETF#ArthurHayes#MarketTrends#Liquidity#RRP#TGA#QuantitativeTightening#Finance#Investing#BullMarket#CryptoNews#MarketPredictions#Inflows#Christmas2025#LiquidityDrivers