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

Резултати

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

Пребарај: #stability

当前筛选 #stability清除筛选
科技&趣闻&杂记

@kejiqu · Post #3443 · 18.05.2025 г., 08:20

Stability AI 发布可在移动设备上运行的紧凑型开放文本到音频模型 Stability AI 和 Arm 发布了一款在智能手机上运行的紧凑型文本转音频模型,能够在大约 7 秒内生成长达 11 秒的立体声音频片段。 该模型名为“稳定音频开放小型”(Stable Audio Open Small),基于加州大学伯克利分校等研究人员开发的“对抗相对对比”(Adversarial Relativistic-Contrastive,ARC)技术。在 Nvidia H100 GPU 等高端硬件上,它可以在短短 75 毫秒内生成 44 kHz 立体声音频,速度之快足以实现近乎实时的生成。THE DECODER 🏷#Stability#AI#文本到音频#移动设备 📢频道👥群组📝投稿

C U R V E S / Under Magnitude by Marc Fornes / THEVERYMANY The strength of #undermagnitude is achieved by 'Intensive Curvature,' which is the maximization of double #curvature across the project while constraining maximum radii. The result is a #structure that has much tighter curvature with constant change of direction, and results in more structurally performance. 'Intensive Curvature' leads to the curly, tubular branching characteristics consistent across the studio's body of work. In order to achieve structural #stability , each stripe assumes high degrees of curvature individually and high degrees of double curvature in accumulation -- amounting to extreme structural #rigidity throughout the project. #arch_shovel#archdaily

Crypto M - Crypto News

@CryptoM · Post #64619 · 09.04.2026 г., 11:35

🚀 Iranian Parliament Speaker Warns of Consequences for Ceasefire Violations On April 9, Iranian Parliament Speaker Mohammad Bagher Ghalibaf stated that any breach of the ceasefire agreement will result in clear consequences. According to BlockBeats, Ghalibaf emphasized the importance of adhering to the terms of the agreement to avoid potential repercussions. The statement underscores the significance of maintaining peace and stability in the region. #Iran#Parliament#Ceasefire#Consequences#Peace#Stability#MiddleEast

Crypto M - Crypto News

@CryptoM · Post #64966 · 10.04.2026 г., 12:33

🚀 Canada's March Unemployment Rate Matches Previous Value at 6.7% Canada's unemployment rate for March was reported at 6.7%, according to Jin10. This figure aligns with the previous month's rate and is slightly better than the anticipated 6.80%. The data suggests stability in the Canadian labor market during this period. #Canada#unemploymentrate#March2026#labor market #stability#Jin10

Crypto M - Crypto News

@CryptoM · Post #65148 · 11.04.2026 г., 12:31

🚀 Bitcoin's Stability Amid Institutional Buying and Whale Selling Bitcoin has maintained a price range between $65,000 and $73,000 over the past six weeks. According to NS3.AI, this stability is due to institutional buying counterbalancing selling activities from whales, miners, medium-sized holders, and Bhutan. U.S. spot ETFs have absorbed approximately 50,000 BTC monthly. Meanwhile, miners have sold over 19,000 BTC in the past week, and whale holdings have shifted from an annual accumulation of 200,000 BTC to a reduction of 188,000 BTC. #Bitcoin#Stability#InstitutionalBuying#WhaleSelling#NS3AI#USSpotETFs#BTC#Miners#WhaleHoldings#PriceRange#Crypto

Crypto M - Crypto News

@CryptoM · Post #64930 · 10.04.2026 г., 10:28

🚀 Finland to Restrict Nuclear Weapons Deployment During Peacetime Finland has announced plans to declare its intention not to station nuclear weapons on its territory during peacetime, despite ongoing legislative changes that would permit such a deployment. Bloomberg posted on X, highlighting Finland's strategic decision amid evolving security dynamics in the Nordic region. The move comes as Finland reassesses its defense policies in response to regional security concerns. The country's government is working on legal amendments that would enable the deployment of nuclear weapons if deemed necessary in the future. However, Finland remains committed to maintaining a nuclear-free stance during times of peace, reflecting its cautious approach to national security. This decision aligns with Finland's broader defense strategy, which prioritizes stability and peace in the region. The legislative changes are part of Finland's efforts to enhance its defense capabilities while ensuring transparency and adherence to international norms. Finland's stance on nuclear weapons deployment underscores its commitment to regional security and diplomatic engagement. #Finland#NuclearWeapons#Peacetime#DefensePolicy#RegionalSecurity#NordicRegion#NationalSecurity#Diplomacy#LegislativeChanges#NuclearFree#InternationalNorms#Stability

Venture Village Wall 🦄

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

Bay Harbor Re Secures $50M Funding Bay Harbor Re, a reinsurance firm, has announced a funding round of $50 million, set for December 13, 2024. The company focuses on delivering stability and protection tailored to meet the specific needs of its partners. #Reinsurance#Funding#Investment#BayHarborRe#FinancialServices#Insurance#Stability#Protection#Partners#BusinessDevelopment#MarketInsights#RiskManagement#Capital #2024 #Profitability#Growth#InsuranceMarket#CorporateNews#FundingRound

Venture Village Wall 🦄

@venturevillagewall · Post #3903 · 17.01.2025 г., 13:00

Market Trends Impact Developer Salaries Developers face salary stagnation as the job market grows competitive. With more candidates than job openings, mid-senior professionals find job switches yield minimal salary increases. Becoming a tech lead is rare and corporations limit hiring senior candidates. Stability may lie in entrepreneurship or pet projects instead. Consider exploring these options for long-term financial health. #JobMarket#DeveloperSalaries#Entrepreneurship#PetProject#IT#CareerGrowth#TechIndustry#EmploymentTrends#SalaryTrends#BusinessModel#Stability#Competition#JobSwitch#MidCareer#SeniorDevelopers#MarketAnalysis#ITCareers#FinancialPlanning#TechJobs#Startup#TechLeadership