@all_bts_updates · Post #109374 · 13.09.2025 г., 14:41
CORTIS sings happy birthday to #RM during his live on Weverse ! -@All_BTS_Updates
Hashtags
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
Пребарај: #rm
@all_bts_updates · Post #109374 · 13.09.2025 г., 14:41
CORTIS sings happy birthday to #RM during his live on Weverse ! -@All_BTS_Updates
Hashtags
@all_bts_updates · Post #108972 · 24.08.2025 г., 14:16
📊 CHARTS] "Indigo" by #RM now hits 900 Million streams on Spotify...! CONGRATULATIONS NAMJOON CONGRATULATIONS RM -@All_BTS_Updates
Hashtags
@OUR_7_PRINCES · Post #114719 · 19.07.2025 г., 16:44
#RM at the wedding of Kim Youngjin and Lee Hajeong in Seoul. #INFO •@OUR_7_PRINCES•
@OUR_7_PRINCES · Post #114718 · 19.07.2025 г., 16:43
Tae Hoon Lee (Nike’s Korea Marketing Director) shared a picture of #RM with J-Hope and Suga at the wedding. #INFO •@OUR_7_PRINCES•
@OUR_7_PRINCES · Post #113788 · 18.06.2025 г., 23:41
#RM in his session talk for Samsung Art TV at Art Basel. #INFO •@OUR_7_PRINCES•
@OUR_7_PRINCES · Post #113780 · 18.06.2025 г., 23:41
#RM spotted at Art Basel's Messeplatz in Switzerland. #INFO •@OUR_7_PRINCES•
@OUR_7_PRINCES · Post #113774 · 18.06.2025 г., 23:41
#RM spotted at Art Basel's Messeplatz in Switzerland. #INFO •@OUR_7_PRINCES•
@OUR_7_PRINCES · Post #113772 · 18.06.2025 г., 23:26
#RM via Amalia Wirjono (Museum MACAN's Head of Development) instagram. https://www.instagram.com/p/DLDS91PTkYX/?igsh=aGU2ZXc2bGk2cGw2 #INFO •@OUR_7_PRINCES•
@OUR_7_PRINCES · Post #115031 · 01.08.2025 г., 08:42
RM INSTAGRAM STORY UPDATE 💜 Translation Weren’t you curious? You must have been very curious. But writing is something you keep doing because you think you can’t help it, even if you won’t become a good writer. They probably kept writing, and by doing so, they became writers. Now they are probably getting asked the same question I get: ‘Did you always think you’d become a writer?’ If you live like a useless boat drifting with the tide, you eventually arrive somewhere. That is the future. And it comes even if you do nothing. When you finally reach that future, there is something everyone does—rewrite the preface of the past to match the ending [this quote is from a book. It’s attributed to Kim Young-ha (김영하) and appears in his novel A Single Life (단 한 번의 삶) .] #RM | #INSTAGRAM •@OUR_7_PRINCES•
Hashtags
@OUR_7_PRINCES · Post #114745 · 21.07.2025 г., 14:52
RM INSTAGRAM POST UPDATE 💜 🐨: nonchalant #RM | #INSTAGRAM •@OUR_7_PRINCES•
Hashtags
@OUR_7_PRINCES · Post #114717 · 19.07.2025 г., 16:42
Artist Yoon Jiyong shared this picture of #RM on instagram story. #INSTAGRAM •@OUR_7_PRINCES•
Hashtags
@OUR_7_PRINCES · Post #114715 · 19.07.2025 г., 16:42
#RM via rkive repost: 1. Eyes Magazine editor Jin Pyo: “Kim euri @ rkive You’re really a good host/MC.” 2. Post Archive Fasion Creative Director Lim Dongjoon: “You're the best MC/host I've ever seen...” #RM | #INSTAGRAM •@OUR_7_PRINCES•
Hashtags