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 слични објави

Пребарај: #tokensale

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

@venturevillagewall · Post #4161 · 15.02.2025 г., 16:00

Token LIBRA Crashes 94% in Hours 🚨 Argentine President Javier Milei's promoted token LIBRA plummeted 94% shortly after launch, with insiders cashing out over $107 million. Initial market cap peaked at $4.56 billion but has dropped to $174 million. The token was marketed as a tool to boost Argentina's economy. Milei later removed his promotional post and blamed political opponents for the fallout. 📉 Link to details: Full story #Crypto#Argentina#LIBRA#Trading#MarketCrash#TokenSale#InsiderTrading#ETH#VC #Crypto#Argentina#LIBRA#Trading#MarketCrash#TokenSale#InsiderTrading#ETH#VC

🚀🚀The intelligent investors💯💯

@the_intelligent_investors · Post #1632 · 01.02.2025 г., 08:34

🚀 Blockchain Energy is LIVE! 🔥 The world’s first physical blockchain product is here—introducing Blockchain Energy! 💥 Our website and ICO are officially LIVE, and early buyers can now purchase BET tokens at. www.blockchainenergy.co.uk. 💰 Buy early before prices increase! Price alerts and community updates will be shared exclusively on our Telegram group – join now: https://t.me/+vLcj22SyWvY2ZDg0 🔗 Powering the future of blockchain with real-world energy! #BlockchainEnergy#BETToken#CryptoLaunch#ICO#BlockchainRevolution#CryptoCommunity#Web3#CryptoInvesting#TokenSale#CryptoPresale

Venture Village Wall 🦄

@venturevillagewall · Post #4036 · 31.01.2025 г., 07:00

Errol Musk's Token Plans to Raise Millions Errol Musk aims to raise $150-$200 million through the "Musk It" memecoin, leveraging his family name. Proceeds will support the newly established Musk Institute. Recently, the crypto space has faced various rug pulls linked to projects of the same name. 🪙💰Read more here #Musk#Memecoin#Crypto#ETFs#USDC#Ethereum#DeFi#Blockchain#Investment#Finance#ElonMusk#Bitcoin#WhaleAlert#RugPull#MuskInstitute#CryptoMarket#DigitalAssets#TokenSale#Cryptocurrency#MarketTrends#VC

Venture Village Wall 🦄

@venturevillagewall · Post #3850 · 11.01.2025 г., 19:00

$1M Raised for E3 Enclave Project Open-source protocol E3 Enclave successfully raised $1M during its public sale, achieving a $60M fully diluted valuation. The sale was conducted on the Legion platform. Meanwhile, AI-focused protocol BAD Coin secured $1.25M at a $12.5M valuation, emphasizing growth in the AI and crypto sectors. Read more: E3 Enclave | BAD Coin #E3Enclave#BADCoin#AI#Crypto#PublicSale#Blockchain#Funding#Legion#Investment#TechNews#Finance#DeFi#Innovation#Startups#VentureCapital#CryptoNews#TokenSale#Valuation #2025 #Oklahoma#Fraud

Venture Village Wall 🦄

@venturevillagewall · Post #3929 · 20.01.2025 г., 13:00

Major Crypto Transactions and Trends Unveiled 🚨 A massive transfer of 25,000,000 #XRP ($81.44M) has been reported from #Upbit to an unknown wallet. For details, visit Whale Alert. The Ethereum Foundation sold 100 ETH for 336,000 DAI amidst discussions on staking options, highlighting ongoing regulatory concerns voiced by Vitalik Buterin in a recent tweet here. Additionally, Bitcoin volatility spikes as the price reaches $109K, correlating with a surge in investment inflows totaling $2.2 billion this past week, largely driven by euphoria surrounding the Trump inauguration. For more on the latest market trends, refer to CoinShares report. #XRP#Bitcoin#Ethereum#Crypto#Investment#Regulation#DeFi#Funding#VC#Upbit#TokenSale#CryptoMarket#WhaleAlert#Trump#Hawala#MemeToken#Finance#DAI#CryptoTrends#Layergg#Grix