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

Резултати

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

Пребарај: #alpaca

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

@proanalysistrader · Post #28241 · 22.11.2024 г., 12:58

#ALPACA/USDT analysis : #ALPACA is currently in an uptrend, demonstrating a series of higher highs (HHs) and higher lows (HLs). The price is currently consolidating above the 200-period exponential moving average (EMA), and a bounce is expected, which would reinforce its bullish momentum. For a long entry, it is recommended to wait for a breakout above the $0.1780 level to confirm the upward movement. TF : 4h Entry : $0.1780 Target : $0.2300 SL : $0.1520

Hashtags

Binance crypto champions

@binancecryptochampions · Post #2276 · 30.04.2025 г., 09:08

✴️Free signal-Futures ✴️ ⚡️⚡️#ALPACA/USDT⚡️⚡️ Exchanges: Binance Futures, ByBit USDT, KuCoin Futures Signal Type: Regular (Short Leverage: Cross (10.0x) Entry Targets: 1) 1.0930 2) 1.2212 Take Profit Targets: 1) 1.0205 2) 0.8585 3) 0.7872 Stop Targets: 1) 1.3575 🌱 Published By: @Trading_exp🌱

Hashtags

Binance Big Pump Signals Future trade

@binancebigpumpsignalsfuture · Post #2191 · 21.03.2022 г., 06:46

#ALPACA result 3 nd target achieved in just 12 days✅ One more huge quick profit 46%🤑💰🤑 👉 Still thinking? The more you wait more you lose profit ☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal

Hashtags

Binance Big Pump Signals Future trade

@binancebigpumpsignalsfuture · Post #2118 · 08.03.2022 г., 16:10

#ALPACA result 1st target achieved in just 14 minutes ✅ One more huge quick profit 4.5%🤑💰🤑 👉 Still thinking? The more you wait more you lose profit ☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal

Hashtags

Hedera's Homestead

@HederasHomestead · Post #1365 · 20.01.2022 г., 23:27

More thoughts on spinning. I hope you'll indulge me with this detour/personal journey of mine. Processing and spinning wool seems an unnecessary and tedious task when there is everything else to worry about. However, some animals, like sheep, can be dual purpose. Why not learn to utilize what else they have to offer? For some of us, the fiber is so worthwhile that we'd keep animals just for that purpose alone! (Hence my alpaca obsession - plus they are cheap therapy!) The reason why I'm starting to love spinning is because it is a mindful, yet mindless task that you can simply pick up and tend to without thought. Just feeling, stretching, twirling. With knitting, you must actively think. Processing and spinning fiber is a perfect complement to the art, a duty to put thoughts to rest and focus only on how the fiber feels. It's not about getting it done quickly, it's not about profit. It's about enjoying your time and feeling empowered in what you're able to create with your own hands. #spinning#alpaca

Hedera's Homestead

@HederasHomestead · Post #1364 · 20.01.2022 г., 00:34

Elaborating on the Removal of Vegetable Matter (specifically when there's a lot of it) And thoughts on your environment's impact on how dirty your fleece gets #spinning#alpaca

Hedera's Homestead

@HederasHomestead · Post #1361 · 19.01.2022 г., 06:05

How things are going. This is a Golding top whorl drop spindle. They kindly sent me some kind of hideous fiber to experiment with, which I gladly did, although I found it awful to work with. Probably not the best intro to spinning. I skirted and clouded a small portion of Obsidian's fleece to see how it does in comparison. My hand carders are still sitting in my PO box, so I still have to wait for that - it makes the fluffing easier. No wash, just taking bits of vegetable matter out, and I gotta tell ya, it is really messy. Fluffing and picking seemed to get a lot of dust out, so spinning isn't that dirty, actually. It may even be giving it more grip. It is far easier to spin that I expected. People say alpaca is not a good wool to start with because it's too slippery, but I found it extremely easy to draft and spin evenly. It may have something to do with the generous 3" of staple length. I will try to record a short video of the skirting process tomorrow. Still new, but learning. #spinning#alpaca

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