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

Резултати

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

Пребарај: #etfs

当前筛选 #etfs清除筛选
Crypto Media

@crypto_medias · Post #1521 · 21.02.2025 г., 18:29

🗽👀 A WAVE OF CRYPTOCURRENCY #ETFS AWAITING REGULATORY APPROVAL. WHICH ETF WILL BE APPROVED NEXT?

Hashtags

SIGNAL

@finsignal · Post #3203 · 05.06.2024 г., 12:54

Yesterday, the inflow into spot #Bitcoin#ETFs amounted to ~$886.75 million — this is the second largest one-day net inflow in history.

SIGNAL

@finsignal · Post #2735 · 26.12.2023 г., 08:56

⚡️ Arthur Hayes' essay "Expression" The main theses: If the #ETFs managed by TradFi are too successful, they will completely destroy #Bitcoin If $BTC becomes just another financial asset controlled by the state, it will die Because of their confusion and laziness, people buy Bitcoin ETF derivatives, rather than buying and storing bitcoins in their own wallets.

SIGNAL

@finsignal · Post #3402 · 21.07.2024 г., 14:44

💎 American issuers of spot #Bitcoin#ETFs have accumulated more than 900,000 #BTC ($60 billion) — this is 4.3% of the total issue of the first cryptocurrency.

SpotOnChain | Announcement

@spotonchain · Post #1233 · 02.07.2025 г., 06:08

🇺🇸 Spot ETF: 🔴$342.2M to $BTC and 🟢$40.7M to $ETH 🗓 July 1, 2025 👉 BTC ETFs saw the first net outflow after 15 consecutive trading days of net inflows. 👉 ETH ETFs is on a 3-day streak of net inflows, totalling $150M. Follow @spotonchain for the latest updates about #Bitcoin and #Ethereum#ETFs now!

SpotOnChain | Announcement

@spotonchain · Post #1231 · 01.07.2025 г., 08:30

🇺🇸 Spot ETF: 🟢$102.1M to $BTC and 🟢$31.8M to $ETH 🗓 June 30, 2025 👉 BTC ETFs have seen 15 consecutive net inflows, totalling +$4.734B. Follow @spotonchain for the latest updates about #Bitcoin and #Ethereum#ETFs now!

SpotOnChain | Announcement

@spotonchain · Post #1226 · 25.06.2025 г., 04:38

🇺🇸 Spot ETF: 🟢$588.6M to $BTC and 🟢$71.3M to $ETH 🗓 June 24, 2025 👉 BTC ETFs extended their streak of net inflows to 11 trading days, totaling +$3.354B. 👉 ETH ETFs have seen 2 consecutive net inflows, with $172M added. Follow @spotonchain for the latest updates about #Bitcoin and #Ethereum#ETFs now!

SpotOnChain | Announcement

@spotonchain · Post #1222 · 19.06.2025 г., 08:12

🇺🇸 Spot ETF: 🟢$388.3M to $BTC and 🟢$19.1M to $ETH 🗓 June 18, 2025 👉 BTC ETFs have seen net inflows for 8 consecutive trading days, totaling +$2.408B. 👉 ETH ETFs also extended their streak of net inflows to 3 trading days. Follow @spotonchain for the latest updates about #Bitcoin and #Ethereum#ETFs now!

SpotOnChain | Announcement

@spotonchain · Post #1220 · 18.06.2025 г., 07:49

🇺🇸 Spot ETF: 🟢$216.5M to $BTC and 🟢$11.1M to $ETH 🗓 June 17, 2025 👉 BTC ETFs have seen net inflows for 7 consecutive trading days, totaling +$2.02B. Follow @spotonchain for the latest updates about #Bitcoin and #Ethereum#ETFs now!

123•••10•••1718
ПретходнаСтраница 1 од 18Следна