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

Резултати

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

Пребарај: #highres

当前筛选 #highres清除筛选
Depth Wallpapers

@Depth_Wallpapers_official · Post #1775 · 09.04.2026 г., 09:17

Quality: 7K ULTRA high res🖼️✨ #highres Want more high res quality wallpapers regularly? Support us 🙏👇 🚀Boost Wallpaper cycle- . Click . Credit for base image: u/Neaterntal

Hashtags

Depth Wallpapers

@Depth_Wallpapers_official · Post #1767 · 03.04.2026 г., 04:10

​Search terms: #porsche ​#gt3rs ​#supercar ​#autumn ​#fallvibes ​#graffiti ​#matteblack ​#redandgrey ​#streetphotography ​#abandoned ​#carwallpaper ​#automotive​#moody ​#leaves#mobile#10k#car#porsche911#highres Preview HD A high-performance Porsche 911 GT3 RS with matte grey and red accents, staged in a moody, industrial setting filled with autumn leaves. High res wallpaper loading... (1min remaining)

Misaka Pics

@moenekononh · Post #14634 · 16.09.2025 г., 11:16

title: original artists: coria url: https://danbooru.donmai.us/posts/9970183 tags: #2girls#animal_ears#bare_shoulders#blonde_hair#coria#green_eyes#highres#long_hair#long_sleeves#looking_at_another#lying#multiple_girls#nontraditional_miko#off_shoulder#on_back#one_eye_closed#open_mouth#original#purple_hair#red_eyes#smile#thighhighs#white_thighhighs#wide_sleeves

Misaka Pics

@moenekononh · Post #15310 · 15.05.2026 г., 12:58

title: hennyano and nachoneko (indie virtual youtuber) artists: madana_(xesa7885) url: https://danbooru.donmai.us/posts/8333388 tags: #1girl#animal_ears#arm_up#bare_shoulders#barefoot#bed#bedroom#blush#borrowed_character#breasts#cat_ears#cat_girl#cat_tail#collar#commentary_request#covered_navel#embarrassed#green_eyes#hair_ornament#hairclip#hennyano_(nachoneko) #highres#indie_virtual_youtuber#indoors#kneeling#leash#legs_apart#long_hair#madana_(xesa7885) #nachoneko#off_shoulder#old_school_swimsuit#one-piece_swimsuit #school_swimsuit#small_breasts#solo#strap_slip#sweat#swimsuit#tail#thighs#v#virtual_youtuber#wet#wet_clothes#wet_swimsuit#white_hair#white_one-piece_swimsuit