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

Резултати

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

Пребарај: #xtz

当前筛选 #xtz清除筛选
Pro Analysis

@proanalysistrader · Post #28430 · 28.01.2025 г., 13:50

#XTZ/USDT analysis : #XTZ is in an uptrend and has broken out above the 200 EMA and previous highs. Currently, the price is retesting the previous resistance zone, which has now turned into support. It is anticipated that the price will rebound from this level and resume bullish momentum to test the previous highs. TF : 1D Entry : $1.012 Target : $1.800 SL : $0.783

Hashtags

Pro Analysis

@proanalysistrader · Post #28342 · 15.12.2024 г., 12:33

#XTZ/USDT analysis : #XTZ has broken below the 200 EMA and has retested it. Currently, the price is encountering resistance from the resistance zone, and it is expected to decline from here. A drop is anticipated, potentially leading to a test of previous lows. TF : 2H Entry : $1.420 Target : $1.150 SL : $1.530

Hashtags

Pro Analysis

@proanalysistrader · Post #28023 · 15.10.2024 г., 14:54

#XTZ/USDT analysis : #XTZ has broken out and retested the previous swing high and the 200 EMA. The price is expected to bounce back from this level and test the higher levels. TF : 4H Entry : $0.694 Target : $0.744 SL : $0.661

Hashtags

Pro Analysis

@proanalysistrader · Post #27837 · 13.08.2024 г., 16:39

#XTZ/USDT analysis : #XTZ is again approaching the 200 EMA resistance after facing rejection from there and is expected to continue its bearish momentum once the zone is tested. The previous low will be the target level. TF : 2H Entry : $0.687 Target : $0.591 SL : $0.709

Hashtags

American Crypto©

@americancryptotrading · Post #27528 · 08.02.2026 г., 10:09

🇺🇸#XTZ/USDT is facing the lowerboundary of the fallingwedge formation on the 2W chart👨‍💻 Expecting a price recovery🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27369 · 09.09.2025 г., 09:42

🇺🇸#XTZ/USDT has retested the s/rzone on the daily chart🔍 The rally is coming🚀 American Crypto©

Hashtags

123•••89
ПретходнаСтраница 1 од 9Следна