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

Резултати

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

Пребарај: #equity

当前筛选 #equity清除筛选
Crypto M - Crypto News

@CryptoM · Post #64865 · 10.04.2026 г., 05:17

🚀 xAI Files Lawsuit to Block Colorado's Senate Bill 24-205 xAI has initiated legal action against the state of Colorado, filing a lawsuit in a U.S. district court on Thursday. According to NS3.AI, the company aims to prevent the enforcement of Senate Bill 24-205, which is set to take effect on June 30. xAI argues that the legislation would necessitate alterations to its Grok platform and impose requirements related to fairness and equity. #xAI#Colorado#SenateBill24205#Lawsuit#AIRegulation#Grok#TechLaw#Fairness#Equity

Venture Village Wall 🦄

@venturevillagewall · Post #4325 · 06.03.2025 г., 22:00

Texas Approves Bitcoin Reserve Bill Texas Senate passes SB21 bill to establish a state Bitcoin reserve, marking Texas as the first U.S. state to officially recognize Bitcoin as a strategic asset. Details on implementation and reserve volumes remain unclear. Read more: Watcher Guru #Texas#Bitcoin#Crypto#Blockchain#Legislation#Innovation#Asset#Reserve#SB21#US#CryptoNews#Finance#Web3#Equity#Investment#Government#Policy#Market#Regulations#VC#AI

Venture Village Wall 🦄

@venturevillagewall · Post #3398 · 18.12.2024 г., 12:10

Svakarma Finance Raises $10.4M Svakarma Finance successfully raised $10.40 million in funding on December 13, 2024. For more details, visit their website. #Funding#Finance#Svakarma#Investment#Capital#Startup #2024 #Market#Growth#Innovations#Loans#FinanceTech#DigitalFinance#Fintech#VentureCapital#Equity#FundingRound#FinancialServices#Economy

Venture Village Wall 🦄

@venturevillagewall · Post #3346 · 18.12.2024 г., 12:06

Bramble Secures $500K Funding Bramble has closed a $500K funding round as of December 4, 2024. The company is focused on improving the home buying experience. #Funding#Bramble#HomeBuying#Investment#RealEstate#Startup#Fintech#Innovations#Tech#Market#Development#FundingRound#Business#Venture#Growth#Capital#Finance#Equity#FundingNews

Venture Village Wall 🦄

@venturevillagewall · Post #3557 · 20.12.2024 г., 09:32

Spine BioPharma Raises $13.51M Spine BioPharma has successfully closed a funding round totaling $13.51 million, announced on December 18, 2024. For more details, visit their official site: Spine BioPharma. #SpineBioPharma#Funding#BioPharma#Investment#Healthcare#LifeSciences#VentureCapital#Startup#ClinicalTrials#MedicinalResearch#Pharma#Innovations#Tech#Biotechnology#Market#Earnings#Growth#Investors#Equity

Venture Village Wall 🦄

@venturevillagewall · Post #3423 · 18.12.2024 г., 12:11

VakıfBank Secures $870M Funding Round VakıfBank has announced a funding round of $870 million, set for November 26, 2024. For more details, visit their official page here. #Funding#VakıfBank#Finance#Investment#FundingRound#Banking#Loans#Capital#Turkey#Business#Economy#November2024#Growth#Market#Assets#InvestmentOpportunities#FinancialServices#InstitutionalInvestors#Debt#Equity

Venture Village Wall 🦄

@venturevillagewall · Post #3594 · 20.12.2024 г., 14:00

OpenAI CEO Salaries Revealed Recent data published by OpenAI reveals salary details for its CEO Sam Altman and former CEO Emmett Shear. Altman earned $76,001 for 2023, translating to approximately $318 per workday over 239 days. In contrast, Shear received $322,201 for just 10 days as CEO, costing around $322 daily. Additionally, Ilya Sutskever earned $322,201, or $1,294 per day. Shear is now starting an AI venture, Stem AI, backed by Andreessen Horowitz, with a focus on human behavior alignment. Notably, the company was registered prior to his brief tenure at OpenAI. #OpenAI#SamAltman#EmmettShear#Salary#AI#TechNews#Startups#Funding#IlyaSutskever#StemAI#AndreessenHorowitz#Business#Leadership#TechCrunch #2023 #StartupLife#Innovation#HumanBehavior#Equity