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

Резултати

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

Пребарај: #profits

当前筛选 #profits清除筛选
Crypto GALAXY

@crypto_galaxy_signals · Post #491 · 18.02.2024 г., 12:39

Boost your #crypto#profits effortlessly with our VIP-Channel. Join now for expert signals and start winning big in the crypto market! 💬Contact & VIP Support

Daily Channels

@dailychannels · Post #6022 · 22.04.2025 г., 01:00

Channel: Bitcoin leverage signals Members: ~9.42K 💢 Username: @bitcoinleverage Description: # BTC USDT leverage signals. Free advice, crypto advice and more. No strings attached. Fair channel. Bitcoin advice, bitcoin trading, trading tips, leverage trading, cryptotrading, stocks. 🏷 Tags: #crypto_fx_trading #bitcoin#crypto#advice#trading#profits https://telegramchannels.me/channels/bitcoinleverage

Daily Channels

@dailychannels · Post #6584 · 02.01.2026 г., 01:01

Channel: Profit Wave FX Members: ~16.9K 💢 Username: @profitwavefxs Description: Click the 3 dot above (open in browser) then it will work. Signal with reason 2025 is the year 🏷 Tags: #crypto_fx_trading #gold#profits#xauusd#trade_wave#signals https://telegramchannels.me/channels/profitwavefxs

Bounty Hunters 💎

@trustedairdropsss · Post #2697 · 07.06.2025 г., 04:49

🚀 Booked ₹1.37+ Lakh Profit! 💰 Another great day in the markets with smart entries & exits. 📈 Check out the power of precision trading! 🔥 🧠 Join my private trading community for real-time insights, setups, and mentorship. Whether you're new or experienced — you’ll level up fast. 👇 Click to join now 🔗https://t.me/+7emcw1k0H_U4ZDg9 📊 Stay ahead, trade smart. 💯 #BankNifty#OptionsTrading#StockMarketIndia#TradeLab#Profits

Bounty Hunters 💎

@trustedairdropsss · Post #2696 · 06.06.2025 г., 14:07

🚀 Booked ₹1.37+ Lakh Profit! 💰 Another great day in the markets with smart entries & exits. 📈 Check out the power of precision trading! 🔥 🧠 Join my private trading community for real-time insights, setups, and mentorship. Whether you're new or experienced — you’ll level up fast. 👇 Click to join now 🔗https://t.me/+7emcw1k0H_U4ZDg9 📊 Stay ahead, trade smart. 💯 #BankNifty#OptionsTrading#StockMarketIndia#TradeLab#Profits

Bounty Hunters 💎

@trustedairdropsss · Post #2695 · 06.06.2025 г., 13:59

🚀 Booked ₹1.37+ Lakh Profit! 💰 Another great day in the markets with smart entries & exits. 📈 Check out the power of precision trading! 🔥 🧠 Join my private trading community for real-time insights, setups, and mentorship. Whether you're new or experienced — you’ll level up fast. 👇 Click to join now 🔗https://t.me/bankniftygo 📊 Stay ahead, trade smart. 💯 #BankNifty#OptionsTrading#StockMarketIndia#TradeLab#Profits

Venture Village Wall 🦄

@venturevillagewall · Post #3941 · 21.01.2025 г., 16:00

NFT Investors Question Trump's Impact A recent survey by NFT Evening revealed that 42% of respondents who bought Official Trump (TRUMP) and Official Melania (MELANIA) NFTs were first-time crypto users. While 81% of TRUMP investors and 86% of MELANIA investors reported profits as of yesterday, nearly 75% believe Trump's NFT launch is harmful to the crypto market. Additionally, 98% chose not to invest further, with 55% asserting that Trump and Melania are attempting to manipulate the market. Read more. #NFT#Trump#Crypto#Investors#Market#MELANIA#Blockchain#Survey#Profits#Regulations#Manipulation#Politics#Investment#Trends#US#KYC#Web3#AI#VC

Venture Village Wall 🦄

@venturevillagewall · Post #3911 · 18.01.2025 г., 10:00

Trump's Meme Coin Launches Amid Trading Frenzy 🚀 Bybit unveils TRUMPUSDT perpetual swap today! Trading also starts on Gate and Bitget for the new meme token TRUMP, which has surged in price in sync with Trump's upcoming inauguration. A trader scored $29.8M in profits from a $1.09M USDC investment, purchasing nearly 6 million TRUMP tokens. Learn more about the frenzy: Forklog News #TrumpCoin#Solana#Bybit#Gate#Bitget#Trading#Crypto#Memecoin#Investing#USDC#Profits#Market#Finance#News#VC#AI#CEX#SpotTrading#Derivatives#MemeToken