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

Резултати

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

Пребарај: #newgame

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

@singsingchannel · Post #767 · 27.08.2024 г., 08:36

🎤 Breaking News: SingSing is about to launch a brand-new game, fully integrated into the Mini App! 🚀 🌟 SingSingers will soon immerse themselves in an endless world of entertainment. 🎉 🎮 Role-play as a karaoke chain manager—build your empire, grow your business and Play to Airdrop! 💰 🎶 Sing for free and get rewarded while you’re at it. 🏅 Stay tuned for more exciting updates! 🔥 #SingSing#NewGame#Karaoke#ComingSoon 🎤Chat | Twitter | Website | Mini App

TRUE LABS

@truegames · Post #30 · 19.09.2024 г., 15:06

⚔️Battle Rage: new game — new UI ⚡️ Our yet to be released game Battle Rage will feature a completely revamped user interface! This is the first game to debut with our fresh, modern design — and trust us, it’s sleek, user-friendly, and visually stunning 🔥 🎮 Unlike many other providers, our new UI will offer a smooth and enjoyable top-notch experience, giving us a major edge in the gaming world. 💯 Not to mention that Battle Rage is set to be the hit of the year! Your favorite streamers will be playing it online, including the legendary Eddie from Stake. So, don't miss out! 💣 ➡️ TRY DEMO NOW! Coming very soon! #BattleRage#newgame#comingsoon#TrueLab#TRUEGames

🏆 Premium, NFT, Tokens

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

🐹Hamster Kombat:New Mini Game Added! A new mini game Hexa Puzzle is now available in the Minigames section! Get ready to test your skills and have fun! 🔑 Unlock the fun and start playing now! 🔔Subscribe👉Join Hamster ⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️ #hamsterkombat#minigames#hexapuzzle#newgame

TRUE LABS

@truegames · Post #28 · 12.09.2024 г., 13:59

🚨 OUT NOW: HOT HAMSTER 🚨 We’re excited to announce the launch of HOT HAMSTER, the latest addition to our TRUELAB HOT SERIES! 🎉 Featuring 30 variable lines and an expanding wild that grows to cover the entire reel, this game captures the fun and simplicity of classic slots while delivering a fresh experience for all players. 🔥 SPIN IT: https://play-test.launcher-gg.com/game/hot-hamster-v4/static/index.html #HotHamster#NewGame#ExpandingWild#TrueClassic#TrueGames#TrueSlots 🔞 | Play Responsibly

APKPure_Official

@apkpurechannel · Post #2644 · 11.09.2025 г., 09:54

📣Introducing a new NYT Pips site, designed to challenge your mind daily! 🔥 5 Daily Puzzles: Progress from Easy to Master! Use daily hints to sharpen your logical thinking. 💚 Easy → 💛 Medium → 🧡 Hard → ❤ Expert → 💜 Master 🤖 Create with AI: Unleash your creativity! Design and generate your own unique puzzles with our AI-powered editor and share them with the world. Ready to play, create, and share? ➡https://mypipsgame.com/ #puzzles#logicgames#braingames#NYTPips#newgame#AI#dailypuzzle

список тегов ! ! #fanart #official #video #gif #animation #edit #screenshot #merch #cosplay #fanmusic - для фанатской музыки (ремиксы, MADы и подобное) #update #newgame #announcement - прочие анонсы игр #other #pixelart #meme #ynfg #yumenikkifangames #dreamdiaryjam #pair #crossover #anniversary #вп хештеги используются без спец. символов, т.е вместо #yume_nikki пишем #yumenikki ! .. cr : ホナ (4091414) on pixiv