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

Пребарај: #singsingsdk

当前筛选 #singsingsdk清除筛选
SingSing Announcement

@singsingchannel · Post #1113 · 16.12.2024 г., 14:26

🚀 1 Month Post-Listing: $SING Update 🎯 Key Utilities ✅ In-Game Payments 💸 Universal currency across all integrated games 🌐 Seamless transactions, potential for discounts & bonuses ✅ Network Fee Payments 💳1,000,000Web3 Users have been paying Tx Fees with $SING ⚙️ Ensuring smooth and cost-effective operations ✅ Launchpool Staking 🛟 Stake $SING to join launchpools & earn game tokens 🌟 Achievements 👉Successfully integrated $SING into 3 games: Mystic Garden, Chickizen, Karaoke Tycoon 🎮 👉Powered 3 Launchpools: KARA, CHICK, AURA 🪙 👉Burned 440,000 $SING to protect its value 🔥 👉 Partnered with Okara Studio, reaching 2,000,000 Web2 users🌐 🔮 What's Next? Exciting new developments with $SING are on the horizon, promising even more engaging and innovative gaming experiences! Easily buy $SING at: - BingX - CoinEx - SingSing Mini App - OKX Wallet: Guideline Stay tuned—$SING is just getting started! 🚀 #SingSing#Web3Gaming#SingSingSDK

SingSing Announcement

@singsingchannel · Post #1049 · 23.11.2024 г., 07:00

🎡 Supreme Spin is about to get even better! 🚀 A new update is coming with bigger rewards 🎁 and an exciting twist: soon, you can use $SING to spin and win! 💎 This is your moment to shine — hold your $SING tight and get ready to aim for the top! Massive prizes await those who are prepared. 🔥 Stay tuned for more details coming soon. Let the spinning madness begin! 🎉 👉#SingSingTycoon#SupremeSpin#SingSingSDK

SingSing Announcement

@singsingchannel · Post #746 · 30.07.2024 г., 10:19

🚨 Exciting News!🚨 🎉The 1st RUBY Halving event is COMING! 🗓Halving Date: TBA RUBY plays a crucial role in the SingSing ecosystem. As we progress, our halving events will strategically decrease RUBY supply, rewarding early supporters of the project. 👉 What to expect: 1️⃣50% reduction in RUBY emissions (after Halving point). 2️⃣Increased scarcity, leading to potential value growth. 3️⃣Enhanced economic stability within the SingSing ecosystem. Prepare for the change and maximize your RUBY holdings! 🌟 #RUBYHalving#SingSingSDK#Event

SingSing Announcement

@singsingchannel · Post #918 · 22.10.2024 г., 13:52

🎉 Supreme Spin is officially LIVE! 🔥 Get ready for massive rewards and a shot at winning TON right at your fingertips! 💎💰 Don’t miss out—spin now for a chance to grab these incredible prizes! 🎯 #SupremeSpin#TONRewards#SingSingSDK 🎤Announcement | Chat | X (Twitter) | Website | Game

SingSing Announcement

@singsingchannel · Post #682 · 08.07.2024 г., 04:11

We're thrilled to unveil our latest innovation that's set to revolutionize the Telegram mini-app ecosystem - SingSing SocialFi SDK. 🛠 Our Developer-Friendly SDK brings powerful social and financial features to developers and users alike with: ✅Seamlessly integrate SingSing's features into your Telegram mini-apps ✅Enhance user engagement and monetization opportunities ✅Leverage SingSing club system ✅Use SingSing payment system 🔒 Our SDK is currently being refined with our early partners to ensure a seamless experience. Stay tuned for the public release! Read more and open treasure at: X Post #SingSingSDK#TelegramMiniApps#Web3Gaming#SocialFi

SingSing Announcement

@singsingchannel · Post #683 · 08.07.2024 г., 04:30

🎉 Exciting Partnership Announcement We're thrilled to introduce our first official partner for the SingSing SocialFi SDK: Cowtopia🐮! Cowtopia, an innovative farming simulation game, will be the first to integrate our powerful SocialFi SDK. This collaboration marks a significant milestone as we prepare to revolutionize the Telegram mini-app ecosystem. Stay tuned and see how Cowtopia will utilize our SDK to create an immersive and socially connected gaming experience. Read more and open treasure at: X Post #SingSingSDK#Cowtopia#TelegramGaming#SocialFi#FarmingSimulator#ComingSoon