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

Резултати

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

Пребарај: #cryptotools

当前筛选 #cryptotools清除筛选

🚀TON Tokens: Is the Memecoin Scene Waking Up? The TON ecosystem keeps growing. Alongside the memecoins themselves, new services appear that make it easier to track data and trade. Trading bots are still few, but the trend is up. 🔍@x1000 — a token aggregator and chat assistant The bot pulls key stats on any token and replies as soon as someone posts a contract address. It works in direct messages or group chats, auto-showing fresh info. We’ve already added @x1000 to our work chat — no need to dig through explorers; the bot does it for us. 👨‍💻What the developer plans next Stepan, the creator (link above), says the next updates will add: 🟠 detailed holder stats 🟠 info on dev teams 🟠 a honey-pot check (can you actually sell the token?) 🟠 a scanner for new coins by custom filters 🟠 a possible scam indicator 💻Try the bot now in the comments or via DM. Just send a contract address, for example: EQA2kCVNwVsil2EM2mB0SkXytxCqQjS4mttjDpnXmwG9T6bO #TON#Memecoin#CryptoTools#TelegramTrading#CryptoNews

Airdrop Comic

@airdropcomic · Post #2060 · 11.07.2025 г., 12:26

🔥Profile Launch - Ronin Profile (LIVE) ✅ 💠Ronin has officially launched its Web3 Onchain Identity system — allowing users to create and manage their own profile with multi-wallet support. ☀️Profile Link :- Click Here ⚙️ How to Participate? ♦️Sign in with your Ronin Wallet (Keyless) ♦️Set up your profile and personalize your details ♦️Bind your social accounts for visibility ♦️Do daily check-ins to stay active ♦️Link up to 6 wallet addresses in one profile 🧩Early version available now — new features coming soon 🔐A keyless wallet is required to access your Ronin Profile 🔗 Source:https://x.com/Ronin_Network/status/1943245375638507811 ®Note - Please do your own research (DYOR) before joining to any airdrops project, also airdrop is 100% free. Don't send any fee or penny for receiving airdrop tokens required #RoninProfile#Ronin#Web3Identity#CryptoTools#Airdropcomic