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

Резултати

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

Пребарај: #hotseries

当前筛选 #hotseries清除筛选
TRUE LABS

@truegames · Post #16 · 13.06.2024 г., 11:48

🔥💸 Feeling Lucky? More like feeling HOT! 💸🔥 HOT MONEY SLOT, the second game in TrueLab’s Hot Series, is OUT NOW. We’ve taken those good old fire and fruit line 3x3 mechanics and turned up the heat with top-notch graphics and sound. The Hot Series games are the perfect complement to any game portfolio. Do you prefer quick action with a classic vibe but can't get yourself to revisit the oldies? This one's for you. Let's go. 🎰 ➡️ SPIN IT: https://bit.ly/Hot-Money-Demo #HotMoneySlot#OutNow#HotSeries#iGamingNews#TrueLab#TrueGames#TrueSlots 🔞 | Play Responsibly

TRUE LABS

@truegames · Post #11 · 28.05.2024 г., 07:49

There's something irresistibly charming about classic slots, and with our HOT Series, we're revamping these favourites with stunning new graphics and smart mechanical changes. Hot Money Slot is up next, featuring 27 variable lines that let you tweak volatility and hit rate to your liking and a hot, shiny new look. 🔥 ➡️ Stay tuned for release on June 13th! 🗓️ #HotMoneySlot#ComingSoon#HotSeries#ClassicsRevamped#TrueGames#TrueLab#TrueSlots

TRUE LABS

@truegames · Post #10 · 24.05.2024 г., 14:48

Brace yourselves—Hot Money Slot will soon fan the flames of your classic gaming desires. As the second sizzling title in the TrueLab Hot Classic Series, this 3x3 firecracker fuses classic slot excitement with a scorching fruit theme. Its slot gaming in its Truest form - with vibrant, burning symbols and intense action with every spin. 🍒🍉🍋🔥 Feeling lucky? Or just love playing with fire? Either way, this game's got your name all over it. Stay tuned, and keep your fire extinguishers handy. 🔥🍒 🗓️ DEMO OUT NEXT WEEK! #HotMoneySlot#ComingSoon#HotSeries#TrueLabGames#TrueClassics#TrueGames#TrueSlots

TRUE LABS

@truegames · Post #8 · 06.05.2024 г., 08:52

The clocks are ticking down, and things are heating up! We're now only 2 days away from the launch of HOT DEVIL SLOT, the first of 3 titles to form part of our classic-inspired HOT SERIES! 🔥 🗓️ Let's raise a little hell come Wednesday 8th May! 😈 #HotDevilSlot#HotSeries#OutSoon#NewSlots#TrueLab#TrueSlots#TrueGames

TRUE LABS

@truegames · Post #20 · 17.07.2024 г., 16:56

100 HOT SLOT is OUT NOW! As the grand finale of our three-way TrueLab Hot Series, this classic slot features 100 lines for maximum enjoyment and fiery fun. 🍒🍉🍋🔥 Don’t miss out on this blazing conclusion to our Hot Series! SPIN IT! ➡️https://bit.ly/100HS-Demo #100HotSlot#HotSeries#OutNow#FruitAndFire#ClassicSlots#TrueLab#TrueGames#TrueSlots