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

Резултати

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

Пребарај: #davidsacks

当前筛选 #davidsacks清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4292 · 03.03.2025 г., 04:00

Sacks Sells Crypto Holdings Amid Review David Sacks, White House AI and crypto czar, sold all his Bitcoin, Solana, and Ethereum holdings post-Trump's inauguration. This move precedes a government ethics review with plans for a full holdings update. More details: FT. #AI#Crypto#VC#Bitcoin#Ethereum#Solana#DavidSacks#CraftVentures#TrumpAdministration

Crypto M - Crypto News

@CryptoM · Post #64750 · 09.04.2026 г., 18:16

🚀 David Sacks Calls for Congressional Action on CLARITY Act David Sacks has called on Congress to pass the CLARITY Act, emphasizing that it would establish clear regulations for all crypto assets. According to NS3.AI, Sacks highlighted that last year's stablecoin regulation bill positioned the U.S. as a leader in the stablecoin industry. He also predicted that U.S. President Donald Trump will sign the bill into law. #DavidSacks#CLARITYAct#Congress#CryptoRegulation#Stablecoins#USPolitics#Cryptocurrency

Crypto M - Crypto News

@CryptoM · Post #65252 · 12.04.2026 г., 10:15

🚀 CLARITY Act Urged for Swift Advancement in Crypto Regulation Cynthia Lummis emphasized the urgency of advancing the CLARITY Act, warning that delays could push the next opportunity for establishing a crypto regulatory framework to 2030. According to NS3.AI, notable figures such as David Sacks, Brian Armstrong, and SEC Chairman Paul Atkins have also expressed support for expediting market structure legislation. #CLARITYAct#CryptoRegulation#CynthiaLummis#NS3AI#DavidSacks#BrianArmstrong#PaulAtkins#SEC#MarketStructure#Legislation

Venture Village Wall 🦄

@venturevillagewall · Post #4288 · 02.03.2025 г., 19:00

Trump's Crypto Reserve Announcement Shakes Market President Trump recently revealed plans for a U.S. Crypto Strategic Reserve, leading to a significant surge in Bitcoin value, which rose 10% to $94,000. The reserve will include Bitcoin, XRP, Solana, and Cardano, positioning the U.S. as a potential leader in the crypto space. Following this announcement, nearly $500 million in shorts were liquidated within four hours. The announcement reflects Trump's commitment to strengthen the crypto industry after previous governmental opposition. More updates are expected at the upcoming crypto summit in the White House on March 7. #Crypto#Bitcoin#XRP#Solana#Cardano#TRUMP#U.S. #CryptoReserve#MarketUpdate#ShortsLiquidation#WhiteHouse#Summit#Finance#Investment#Assets#Blockchain#DavidSacks#Economy#DigitalAssets#Trading

Venture Village Wall 🦄

@venturevillagewall · Post #4069 · 04.02.2025 г., 22:00

US Forms Joint Group for Crypto Rules David Sacks announced a joint working group of the U.S. House and Senate, focusing on advancing cryptocurrency legislation, starting with stablecoins. Additionally, a feasibility study for a U.S. Bitcoin reserve is underway. Read more. Senator Bill Hagerty has introduced legislation for a regulatory framework for stablecoins. Details here. #US#Crypto#Stablecoins#Bitcoin#Legislation#Securities#DeFi#Blockchain#Finance#DavidSacks#Senate#House#BitcoinsReserve#BAMM#FraxFinance#Hagerty#SEC#CryptoTaskForce#Regulation