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

Резултати

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

Пребарај: #ieltsprep

当前筛选 #ieltsprep清除筛选
Andijan Development Center

@adceducate · Post #8208 · 17.02.2024 г., 11:51

We recently hosted a mock IELTS test at our educational center, offering participants a true-to-life exam experience. 📚✍️ The event meticulously recreated the conditions of the actual test, helping attendees familiarize themselves with the IELTS format and timing. ⏳ Participants had the chance to practice their English under timed conditions, assessing their readiness for the real exam. 🇬🇧🕒 Feedback from attendees was overwhelmingly positive, appreciating the opportunity to simulate the test day in a supportive and structured setting. 👏💼#IELTSPrep#MockTest#EnglishPractice

Erkinov Otabek || IELTS

@cambridgeieltsbooks · Post #4424 · 21.04.2024 г., 14:10

✅Listening Time 😎High Frequency Words in IELTS Listening🎧 Knowing what kind of vocabulary to expect in IELTS listening can greatly improve your performance in the actual exam. Come to @cambridgeIELTSbooks and see if you know the meaning of all 378 high frequency words. #listening#IELTSprep ♡ ㅤ ❍ㅤ ⎙ㅤ ⌲ ˡᶦᵏᵉ ᶜᵒᵐᵐᵉⁿᵗ ˢᵃᵛᵉ ˢʰᵃʳᵉ ━━━━━━━━━━━━━ ❤️Sharing is caring❤ ©️Channel:@cambridgeieltsbooks

Erkinov Otabek || IELTS

@cambridgeieltsbooks · Post #3324 · 21.09.2023 г., 08:01

✅ Useful 🤓Identifying Opinion Indicators 💠 Giving personal opinions In my opinion,… I think… I believe… I’d say… I personally feel that… In my point of view,… From my way of thinking… In my mind… 💠 Asking for opinions What do you think about…? How do you feel about…? What are your views on…? Do you think…? Don’t you think…? 💠 Agreeing Yes. You’re right. I suppose you’re right. I (completely) agree. I couldn’t agree more. Exactly. Definitely. Absolutely. 💠 Disagreeing Yes, but… I’m afraid I don’t really agree. I can’t say that I agree. I (completely) disagree. I don’t think so. I doubt it. I wouldn’t say that. Not really. 💠 Expressing reservation Yes, but the problem is… I’m not so sure if… But there’s one problem… I’m a little worried about… #IELTSprep#writing#speaking 🤓Kanalga qo'shiling 👇 ♻️@cambridgeIELTSbooks YouTube|Instagram|Telegram

Erkinov Otabek || IELTS

@cambridgeieltsbooks · Post #3206 · 10.09.2023 г., 02:18

#writing#IELTSprep#task1 ✅ Essay corrections ⁉️IELTS writing siz uchun muhimmi? Uni yaxshilash uchun nima qilish kerak deb o'ylaysiz? ✅ Eng yaxshi yechim, insholaringizni tekshirtirish orqali xatolar ustida ishlashdir. Siz ham shu fikrga qo'shilasizmi? 🤝Biz sizga bir nechta insho tahlilini ulashyapmiz. Siz ham do'stingizga ilining! ♻️Channel: @cambridgeIELTSbooks

Erkinov Otabek || IELTS

@cambridgeieltsbooks · Post #4105 · 23.03.2024 г., 00:59

✅Writing Time 📝Writing task 2 insho savoli o'z ichida 3 qismga boʻlinadi va ular introduction(kirish) qismida quyidagicha o'zgartirilishi kerak. 🍇Background statement (umumiy insho mavzusi) 🍎Specific statement (aniq talab etilayotgan insho mavzusi) 🍓Question (insho savoli) ‼️Ana endi keling, insho kirish qismini qismma-qism yozib chiqaylik. 🍇 When a country develops its technology, traditional skills and ways of life die out.🔁With the development of technology, a nation loses its traditional skills and way of life. 🍎 It is pointless to try and keep them alive. 🔁Many believe that these become irrelevant and there is no use trying to maintain them. 🍓To what extent do you agree or disagree with this? 🔁I completely disagree, however, and will explain why I believe keeping a nation's traditional skills and lifestyle is important, despite the rise of new technologies. If you find it useful, don't forget to share with your friends ☺️ #writing#task2#IELTSprep ❤️Sharing is caring❤ ©️Channel:@cambridgeieltsbooks

12
ПретходнаСтраница 1 од 2Следна