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

Резултати

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

Пребарај: #one

当前筛选 #one清除筛选
Coin Sonar

@CoinSonar · Post #243768 · 17.04.2026 г., 16:12

#ONE | Volume spike (USDT PAIR) 101 times the average volume 108.21K USDT traded in 5 min └Buying vol: 77.02K USDT 🟢 Boost score: 6/10 24h Vol: 306.62K USDT (Binance) Price: 0.00251 (-2.7% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28291 · 30.11.2024 г., 16:00

#ONE/USDT analysis : #ONE has broken out of the trendline following a bounce from the support zone, accompanied by a strong volume candle. The price is expected to continue its bullish momentum soon and test the previous highs. A potential gain of +1100% is anticipated from the current level. TF : 1M Entry : $0.03000 Target : $0.37897 SL : $0.02100

Hashtags

Pro Analysis

@proanalysistrader · Post #27862 · 21.08.2024 г., 14:22

#ONE/USDT analysis : #ONE is currently forming a structure of higher highs (HHs) and higher lows (HLs) above the 200 EMA. The price is anticipated to sustain its momentum and reach new highs. Wait for a pullback to enter long positions. TF : 1H Entry : $0.0113 Target : $0.0122 SL : $0.0108

Hashtags

Pro Analysis

@proanalysistrader · Post #27849 · 17.08.2024 г., 15:29

#ONE/USDT analysis : #ONE is currently consolidating sideways within the support and resistance zone. At the moment, the price is bouncing off the support zone and is expected to test the resistance zone. TF : 4H Entry : $0.0104 Target : $0.0110 SL : $0.0100

Hashtags

Pro Analysis

@proanalysistrader · Post #27708 · 26.06.2024 г., 06:31

#ONE/USDT analysis - #ONE is in a downtrend making lower lows (LLs) and lower highs (LHs). The price is currently facing resistance and is expected to be rejected from there, continuing its bearish momentum to test previous lows. TF : 4h Entry : $0.0150 Target : $0.0133 SL : $0.0162

Hashtags

American Crypto©

@americancryptotrading · Post #27441 · 17.11.2025 г., 09:10

🇺🇸#ONE/USDT is bouncing off the supportzone on the weekly timeframe🧐 Looks good for the midterm✈️ American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27337 · 09.08.2025 г., 09:08

🇺🇸#ONE/USDT is currently shaping the descendingtriangle pattern on the daily timeframe👀 Looking for a recovery🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27066 · 28.11.2024 г., 17:43

🇺🇸#ONE/USDT is testing the s/r zone on 3D timeframe👨‍💻 Full send if we manage to break upwards🐃 American Crypto©

Hashtags

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