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

Пребарај: #joinusnow

当前筛选 #joinusnow清除筛选
SLEX NEWS

@slex_io · Post #105 · 01.10.2023 г., 08:09

📢Open Doors for Listing on SLEX Exchange!🚀 🎉Starting October 5th, we're officially launching our listing campaign on the SLEX platform! If you've been seeking a robust platform for your project, now is the moment. 🤝Why list with SLEX? ✅Liquidity Support & Global Promotion - We've got your back with robust liquidity options and a global promotional strategy. ✅Integration with Slavi Wallet & Fiat Pairing - Seamless integration and more trading pairs to enhance user experience. ✅ Personalized Guidance & Rapid Listing - A dedicated team to guide you through every step for a smooth listing process. ✅CMC and Coingecko Assistance - We facilitate smoother interactions with major platforms for your token's recognition. ✅Vibrant User Base & Market-Making Services - Access to our engaged community and top-tier market-making solutions. 📝Follow this link and submit an application to take a chance to be listed on the SLEX platform:🔗surl.li/lbxas #SLEXListings#CryptoEvolution#JoinUsNow Email | Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter

Airdrop Market Pro

@airdrop_market_pro · Post #726 · 29.07.2024 г., 10:33

Subscribe to our channel and receive a reward in Shiba Inu cryptocurrency! 🐕💰 Don't miss out on this exclusive offer! 🚀#CryptoRewards#ShibaInu#JoinUsNow 165 / 5 000 Подпишитесь на наш канал и получите вознаграждение в криптовалюте Сиба-ину! 🐕💰 Не упустите эксклюзивное предложение! 🚀#CryptoRewards#ShibaInu#JoinNusNow

NFT & Airdrop News

@airdrop_nft1 · Post #722 · 29.07.2024 г., 10:34

Subscribe to our channel and receive a reward in Shiba Inu cryptocurrency! 🐕💰 Don't miss out on this exclusive offer! 🚀#CryptoRewards#ShibaInu#JoinUsNow 165 / 5 000 Подпишитесь на наш канал и получите вознаграждение в криптовалюте Сиба-ину! 🐕💰 Не упустите эксклюзивное предложение! 🚀#CryptoRewards#ShibaInu#JoinNusNow

Airdrop Strikers™

@airdropstrikers · Post #1187 · 16.04.2023 г., 15:33

By participating in our airdrop campaign, you will not only get a chance to earn JIM tokens, but you will also get an opportunity to be a part of the most revolutionary project of the year. So, don't miss out on this amazing opportunity and join us now! 🙌 https://gleam.io/CmtmH/jimmy-project-airdrop-campaign Spread the word and invite your friends to join the Jimmy project community. Together, we will soar to new heights!🚀#JimmyProject#Airdrop#Cryptocurrency#Blockchain#EarnTokens#JoinUsNow Total $25.000 worth JIM Token supply will be distributed to participants according to points collected. Complete all tasks to benefit airdrop in full! 10 Referral Champions will share 1000 USDT Prize pool!

Andijan Development Center

@adceducate · Post #7940 · 15.09.2023 г., 10:55

📢 Exciting News! 📢 Join our IELTS course with Teacher Danila Polikarpov! 📚✨ 🗓 When: Every Tuesday, Thursday, and Saturday 🕘 Time: 9:00 AM 📍 Where: Mashrab 19A (Hotel branch) 🌟 Why choose our IELTS course? ✅ Expert guidance from Teacher Danila ✅ Proven strategies for success ✅ Comprehensive test preparation ✅ Improve your English skills Don't miss this opportunity to boost your IELTS scores and achieve your goals! 🚀 Enroll today and take the first step towards your IELTS success. Limited seats available, so act fast! Contact us for more information or to reserve your spot. Our branches📍 📍Main office (A. Khaydarov 10) 📍Tennis court (Mashrab 19A) 📍Dialogue (Bobur Shokh 11) 📍Eski shahar (Cholpon Shokh 181) 📍Orange (Lomonosov 43) 📍School (Mangulik 14) If you have any questions, do not hesitate to contact us☎️ +998742261078 | +998742281121 | +998958505111 | +998742276163 | +998742252536 | +998952017878 or write on Telegram @admofadc 🔗 Follow ADC Andijan on social media: Telegram | Instagram | Facebook | Tik-Tok #IELTS#EnglishCourse#LearnEnglish#IELTSPreparation#SuccessInIELTS#TeacherDanila#JoinUsNow