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

Пребарај: #engagement

当前筛选 #engagement清除筛选
Go! Announcements

@gorwachain_announcements · Post #348 · 22.02.2024 г., 16:32

🚀 Join us on a journey to revolutionize the world of asset #tokenization and #engagement! 🌍 Our mission is clear: empower individuals and enterprises globally through innovative solutions, strategic partnerships, and #community-driven initiatives. Learn more at: https://goplatform.io/blog/revolutionizing-enterprise-engagement-the-power-of-asset-tokenization-with Together, we can create a transformative ecosystem where everyone has the opportunity to thrive.

Daily Channels

@dailychannels · Post #6560 · 21.12.2025 г., 13:00

Channel: Instagram Accounts & Services Members: ~3.49K 💢 Username: @buyinstaaccounts Description: We Sell Instagram Accounts, Followers, Likes, Views, Commmets Or Any Other Service Regarding Instagram. With 8 Years Of Experience. 🏷 Tags: #games_apps #instagram#accounts#social_media#followers#engagement https://telegramchannels.me/channels/buyinstaaccounts

Go! Announcements

@gorwachain_announcements · Post #1083 · 11.11.2025 г., 22:05

⚡️Coming This Week: Go! Spark ⚡️ We’re launching a Telegram-native engagement engine that lets communities: 🎯Gamify behavior: reward participation & healthy habits 🏆Launch challenges: drive culture & engagement 💎 Reward members: with Go!’s RWA-backed gas & DeAI economy Powered by Go!’s decentralized infrastructure, Spark turns ( & tokenizes ) activity into realfi value for your community. 👀 #GoSpark#DeAI#RWA#Community#Engagement#Gamification

Venture Village Wall 🦄

@venturevillagewall · Post #3383 · 18.12.2024 г., 12:09

TVision Secures $1.5M Funding TVision has raised $1.5M in funding as of December 16, 2024. The company utilizes advanced computer-vision technology to analyze viewer engagement for both Linear and CTV, offering person-level insights into viewing habits. #Funding#TVision#Technology#ViewerEngagement#CTV#Linear#Insights#ComputerVision#Analytics#Viewership#Audience#Engagement#Media#Streaming#Data#Research#Investment

Venture Village Wall 🦄

@venturevillagewall · Post #3770 · 01.01.2025 г., 22:00

Telegram Unveils Major NFT Update 🎉 Telegram introduces a big update allowing gifts and stickers to be converted into NFTs. Gifts gain unique traits like emotions, backgrounds, and colors, enhancing their individuality and value. Rare traits will be limited to 10% of users, creating opportunities for resale at higher prices. Gifts can be converted for 25 Stars, while minting NFTs incurs network fees. Future integration with platforms like Fragment or GG is expected for seamless NFT creation. 🐸 The latest highlight is a unique frog gift gaining traction! For more details, visit: Full Update #Telegram#NFT#Gifts#Crypto#Updates#Blockchain#Stars#Minting#Fragment#GG#Frogs#RareItems#DigitalAssets#Community#Market#Trading#Tech#Innovation#SocialMedia#Engagement#CryptoTrends

Venture Village Wall 🦄

@venturevillagewall · Post #3348 · 18.12.2024 г., 12:06

AI Video Editor Raises $500K Diffusion Studio has secured $500K in funding as of December 4, 2024. Their AI Video Editor simplifies video editing with advanced features such as Magic Cut, Text-Based Editing, and Instant Auto-Captioning, catering to creators and businesses aiming to enhance their video production efficiency. #AI#VideoEditing#Funding#Technology#Creators#Influencers#Business#Automation#Software#Innovation#EditingTools#VideoProduction#TextBasedEditing#AutoCaptioning#Workflow#Engagement#Professional#ContentCreation#Creativity#Efficiency