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

Резултати

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

Пребарај: #nftgaming

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

@singsingchannel · Post #1058 · 28.11.2024 г., 03:54

🌟 MYSTIC GARDEN: WHERE MAGIC MEETS GAMING 🌟 SingSing proudly presents an upcoming game - Mystic Garden, a GameFi adventure! 🌱 Grow elemental plants, craft NFTs, harvest BNB rewards, and battle for leaderboard supremacy. 💎 🚀Launchpool Alert! We’ll snapshot launchpool participants to grant early access to Mystic Garden and offer exclusive rewards! Join Launchpool now - https://t.me/SingSing_TG_bot/app?startapp=_launchpool 📌 Launch Date: Coming Soon. Follow us for whitelist spots and updates! #GameFi#NFTGaming#SingSing

SingSing Announcement

@singsingchannel · Post #1161 · 09.01.2025 г., 12:39

🌟 Exciting News! 🌟 The Map feature is NOW LIVE on Mystic Garden! 🗺✨ 🌿 Claim your land 🌸 Build & grow multiple gardens 🔍 Track everything seamlessly on the map 💡 It’s time to create your very own Mystic World! Ready to explore? 🚀 #MysticGarden#GameFi#NFTGaming 🎤Announcement| Mystic Garden Game |Chat| Spotlight Channel

SingSing Announcement

@singsingchannel · Post #1071 · 03.12.2024 г., 01:57

🚨SingSing Tycoon Update Alert🚨 📜NFT Update • NFTs from Lucky Spin are now locked for trading. • Burning these NFTs is possible, but no $KARA rewards will be given upon burning. 💸Earning Update • Perform Daily Wallet Check-in to enjoy 100% earnings speed. • Miss it? You'll only earn at 50% speed. Stay tuned and optimize your Tycoon journey! 🌟 #SingSing#NFTGaming#tycoon 🎤Announcement | Chat | X (Twitter) | Website | Game

SingSing Announcement

@singsingchannel · Post #1062 · 29.11.2024 г., 07:22

💎 MYSTIC GARDEN: UNIQUE FEATURES 🌱 • 6 Elemental Plant Types to grow & harvest. • Craftable Magic Pots & Elves for strategic boosts. • Daily AURA Rewards to keep the magic flowing. • Special Event Seasons with exclusive prizes. Unlock a magical gaming experience like no other! 🚀 #MysticGarden#GameFi#NFTGaming#SingSing

SingSing Announcement

@singsingchannel · Post #1026 · 19.11.2024 г., 04:21

🚨 Tycoon Master Showdown #5 is coming! 🚨 🔥 Prize Pool: BIGGER x MANY TIMES – you won't want to miss this! 💎Pssst... Your NFTs will be the key to securing your spot in this epic showdown. Time to HODL them tight! 👑 📢 Stay tuned for more juicy deets soon. #SingSingTycoon#NFTGaming#BigRewards 🎤Announcement | Chat | X (Twitter) | Website | Game

🏆 Premium, NFT, Tokens

@giiveaways · Post #3004 · 03.09.2024 г., 13:46

🐶Lost Dogs:The Way - 🏆Last Round’s Winner: Fireworks🎆 📝New Challenge: Which tactic to choose? (Find an average card) 1. Surround 🌀 2. Frontal Attack 🚀 3. Fake Retreat 🎭 🔍Analyze carefully before making your choice! 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

🏆 Premium, NFT, Tokens

@giiveaways · Post #2984 · 01.09.2024 г., 11:56

🐶Lost Dogs:The Way - 🏆 Last Round’s Winner: Decryption Machine 📜New Challenge: How to handle the new information? (Find the average card) 1. Tell Everyone 📢 2. Hide the Truth 🔥 3. Defuse 🛡️ 🔍Analyze carefully before making your choice! 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

🏆 Premium, NFT, Tokens

@giiveaways · Post #2928 · 27.08.2024 г., 16:22

🐶Lost Dogs:The Way - 🥇 Last Round’s Winner: The winning card in the last game was Go Underground🌿 🚀New Challenge: What truth will the Resistance reveal? (Find the average card) 1. Greed of the Cult 🪙 2. About Religious Lies 📖 3. How to Resist 🛠 🔍Analyze carefully before making your choice! 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

🏆 Premium, NFT, Tokens

@giiveaways · Post #2911 · 26.08.2024 г., 18:14

🐶Lost Dogs:The Way - 🥇 Last Round’s Winner: The winning card in the last game was Kidnap🐾 🚀New Challenge: How can Resistance continue the fight? (Find the unpopular card) 1. Invite Newcomers 👥 2. Go Underground 🌿 3. Pirate Radio 🎙 🔍Analyze carefully before making your choice! 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

🏆 Premium, NFT, Tokens

@giiveaways · Post #2884 · 25.08.2024 г., 12:11

🐶Lost Dogs:The Way - 🏆 Last Round’s Winner: The winning card in the last game was Fend Off in Battle! 🛡️ 🚀New Challenge: How should the Resistance Dogs handle the newly born mutant messiah? (Find the average card) 👣 1. Kidnap 🐾 2. Kill ⚔️ 3. Unveil the Origin 🔍 Analyze carefully before making your choice!🧐 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

🏆 Premium, NFT, Tokens

@giiveaways · Post #2869 · 24.08.2024 г., 12:10

🐶Lost Dogs:The Way - 🏆 Last Round’s Winner: The winning card in the last game was Wisdom! 👣 🚀New Challenge: How will they rescue Genghis Gaf, and will they? 1. Fend Off in Battle🔥 2. Stay Low 🏠 3. Rescue Secretly 🤘 Analyze carefully before making your choice! 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

🏆 Premium, NFT, Tokens

@giiveaways · Post #2836 · 22.08.2024 г., 20:05

🐶🐶Lost Dogs: The Way - 🏆Last Round’s Winner: The winning card in the last game was Fight Back!👣 🚀New Challenge: What are the dogs expecting from their beloved wizard's performance? 1. Underground Firework 🎆 2. New Day 🌅 3. Existence’s Purpose 🔮 Analyze carefully before making your choice! 🔔Subscribe👉Join Lost Dogs ————————————————— #lostdogs#crypto#dogs #cryptogame#nftgaming

12
ПретходнаСтраница 1 од 2Следна