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

Резултати

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

Пребарај: #xrock

当前筛选 #xrock清除筛选
TONlines – News

@tonlines · Post #7161 · 11.05.2025 г., 12:06

xRocket News: Stake $XROCK for Telegram Gifts #Telegram#XROCK xRocket News invites participants to stake $XROCK on swap.coffee with a 22% APR to enter a Telegram gifts lottery. New positions between May 11 and May 14 will grant tickets, with winners announced by May 16. Over 900 USDT worth of gifts are available. Source: link @tonlines

TONlines – News

@tonlines · Post #7163 · 11.05.2025 г., 17:24

⚡️Swap.coffee: Instant Rewards and Staking Opportunities #swap#staking#XROCK Swap.coffee offers a unique and efficient staking experience, allowing users to claim their rewards instantly. Currently, a prize giveaway is available for staking $XROCK with friends from @XRocket. Tokens available for staking include CES, XROCK, JETTON, and DFC. Source: link @tonlines

🚀xRocket SocialFi Tools: Cheques — the most powerful tool to reach your target audience GMGM! Have you ever heard about xRocket checques? Of course you have. Cheques are the perfect tool for sending cryptocurrency and growing communities on Telegram ❤️ Every token added to xRocket automatically becomes part of our SocialFi ecosystem, allowing users to create cheques, 🔥 fires, and subscriptions with that token. Today’s post is dedicated to the most popular tool —cheques. 🧾What are cheques? Cheques are a convenient tool for sending cryptocurrency to any Telegram user. They can also be used to distribute tokens in channels and chats to attract new subscribers and increase engagement. ⚙️How does it work? You can create a cheque directly in the xRocket bot by specifying the amount and currency. To send it to multiple users, create a multi-cheque by setting the amount and the number of activations. When creating a cheque, you can also add a referral bonus and rewards for each activation via the link for those who share your cheque. 🔎How to increase cheque reach? There are two built-in mechanisms to help distribute your check: the Cheque Board and the xRocket Drops channel. To have your cheque featured on the Cheque Board, it must meet the following requirements: - Only cheques created in thexRocket bot can be listed; - The cheque must not have a password; - Subscriptions must be public and accessible to users; - The cheque cannot be intended for new xRocket users; - The cheque should have more than 100 activations. 👮‍♂️Important: if you add a password or change the subscription after listing the cheque, it will be removed. Cheques worth 100 USD or more in any supported currency are automatically posted in the xRocket Drops channel. 🚀Create your xRocket cheque #TON#XROCK#community#airdrop#Web3

🚀 Solana on xRocket! GMGM! We are thrilled to announce that the integration of a new blockchain into @xRocket is complete – welcome Solana to your favorite Telegram bot! Solana, known for its vibrant community and activity on X (formerly Twitter), is now seamlessly connected to the platform. This integration enables Solana users to enjoy all the benefits of the Telegram web exchange that we've been relishing for so long. With the addition of Solana, the native token $SOLis now available on xRocket for deposits, storage, and withdrawals. Plus, it's fully supported across all our SocialFi tools: launch fires, distribute checks, and use $SOL for subscriptions. Integrating Solana isn't just about expanding xRocket's capabilities – it's a pivotal step in advancing the entire Telegram ecosystem. The opportunities for collaboration between projects on Solana and Telegram are endless. The xRocket team remains committed to its mission of developing the most user-friendly and versatile CEX & SocialFi application on Telegram. #CEX#SocialFi#bot#Telegram#TON#XROCK#SOL#xRocket 🚀Stay tuned for more exciting updates! Bot | WebExchange | p2p | Channel