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

Резултати

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

Пребарај: #halfguard

当前筛选 #halfguard清除筛选
bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1850 · 30.07.2025 г., 18:49

🔥NEW RELEASE🔥 😁Half Guard by Nicholas Meregali😁 ➡️Master the Half-Guard with 4 hours of step-by-step instruction designed to give you real control and understanding of this essential position. Learn to dominate in three key stages, Legs, Hips, and Shoulders, using each to solve specific problems and create clear, strategic progress. ➡️We start with the core concept of Camping, teaching you how to stabilize your position, manage pressure, and control posture through precise body placement over your opponent’s shields, hips, and frames, making your base extremely hard to off-balance. $197😍$19.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #NicholasMeregali#NewWave#Gi#HalfGuard 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1796 · 05.04.2025 г., 23:10

🔥NEW RELEASE🔥 😁Top Half Guard By Neil Melanson😁 ➡️Unlock a powerful, high-pressure top game with Top Half Guard by legendary coach Neil Melanson. As a master of catch wrestling and MMA grappling, Neil’s unique approach to half guard will completely transform the way you dominate from top position. ➡️Whether you're new to half guard or looking to refine your existing skills, this series gives you the tools to overwhelm your opponent, control the position, and finish the fight with devastating submissions ➡️Learn from one of the most innovative grappling minds in the sport and elevate your game to new heights. $127😍$11.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #NeilMelanson#BJJFanatics#HalfGuard 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1851 · 03.08.2025 г., 22:37

😁Precision Attacks and Sweeps From Butterfly Half and Knee Shield by Shawn Melanson😁 ➡️Shawn Melanson returns with his fifth installment for BJJ Fanatics, and this time he’s pulling back the curtain on the sneaky, frustrating, and relentlessly effective guard system that’s been quietly dismantling opponents at every level. ➡️Melanson's method breaks away from flashy tricks and focuses on the real structure behind guard retention, off-balancing, and transitioning from defense to decisive offense ̶$̶7̶9̶😍$9.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #ShawnMelanson#HalfGuard#NoGi#Butterfly 💁‍♀️Buy 💁‍♀️