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

Резултати

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

Пребарај: #solutions

当前筛选 #solutions清除筛选

Tired of Political Negativity? Try This Instead #shorts#shortsvideo #positivity#hopefulmessage#politicalspeeches#inspiration#positivethinking#uplifting#motivation#politics#hope#shortscontent#shortsvideo#solutions https://pdmovies.substack.com/p/frank-capras-meet-john-doe-1941

Venture Village Wall 🦄

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

Stack AI Secures $16M Funding Stack AI raises $16.08M to enhance productivity by integrating AI with various data sources, enabling organizations to better utilize AI technology. More information can be found at Stack AI. #Funding#AI#Productivity#Data#Tech#Innovation#Investment#Integration#Business#Startups#Growth#Automation#Solutions#Enterprise#Analytics#Software#Digital#Tools

Venture Village Wall 🦄

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

Keepit Secures $50M Funding Keepit raises $50M in funding to enhance its cloud data protection services, leveraging over 20 years of market experience. For more details, visit Keepit. #Funding#Cloud#DataProtection#Keepit#Investment#Tech#Services#Solutions#Market#Experience#Ecosystem#Security#Innovation#Growth#Infrastructure#Digital#Software#Business#Technology

Venture Village Wall 🦄

@venturevillagewall · Post #3486 · 19.12.2024 г., 13:57

Coblocks Secures $500K Funding Coblocks has successfully raised $500K in funding as of December 4, 2024. The platform offers unified tooling, instant deployment, and seamless collaboration in one streamlined solution. #Coblocks#Funding#Tech#Startup#Platform#Collaboration#Deployment#Innovation#Investment#Tools#Startups#InvestmentRound#FundingRound#Financing#Growth#Technology#Business#Software#Solutions#Digital

Venture Village Wall 🦄

@venturevillagewall · Post #3365 · 18.12.2024 г., 12:08

AI Co-Pilot Boosts Architecture Design ArchiLabs raises $500K for its AI co-pilot, designed to enhance architecture efficiency. By utilizing simple AI prompts, architects can significantly speed up their design processes, increasing productivity tenfold. #AI#Architecture#Funding#Design#Efficiency#Productivity#Tech#Innovation#Startups#CoPilot#Automation#Archilabs#Creative#Tools#Software#Solutions#Investment#Entrepreneurship#Prompts#Future

Venture Village Wall 🦄

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

Bnewable Secures $42M Funding Bnewable raises $42.02M to enhance energy solutions, focusing on battery-as-a-service and smart energy management systems. Energy management becomes increasingly vital for companies. #Bnewable#Funding#Energy#Management#Tech#BatteryAsAService#Sustainable#Innovation#SmartSystems#Utilities#Investment#Startups#CleanEnergy#Solutions#Growth#Development#Industry#Future#Strategy#Services

Venture Village Wall 🦄

@venturevillagewall · Post #3476 · 19.12.2024 г., 13:57

$500K Funding for Symphony Symphony has successfully raised $500K in funding for its Conversational AI Recruiter, which streamlines the hiring process for customer-facing roles. This funding round took place on December 4, 2024. More details can be found on their website: Symphony. #Funding#AI#Recruitment#ConversationalAI#Tech#Startups#Innovation#CustomerService#Hiring#Automation#Career#JobMarket#Business#Solutions#Entrepreneurship#Growth#Investment#Operations#Talent#Workforce#DigitalTransformation

Venture Village Wall 🦄

@venturevillagewall · Post #3874 · 14.01.2025 г., 13:00

Funding Rounds Update: January 2025 In January 2025, notable funding rounds included: - Beams secured $9M for a renovation platform enhancing home planning, design, and building. Learn more - KamiwazaAI raised $8.5M, aiming to revolutionize enterprise AI with 1 trillion daily inferences. Learn more - CyGO Entrepreneurs garnered $5.16M for their business initiatives. Learn more - Oh obtained $4.5M for digital twin interactions. Learn more - Varadise received $3M for AI-driven construction solutions. Learn more - Jinli Intelligence brought in $2.73M for intelligent technology solutions. Learn more - Origami Agents raised $2M for their internet research tracking services. Learn more - Novastro secured $1.2M for their L2 chain applications. Learn more - RePut.ai raised $1M for AI tools. Learn more - Quash garnered $635K to automate bug reporting for developers. Learn more #Funding#Startup#AI#Construction#Tech#DigitalTwin#Automation#Enterprise#Research#Platform#Solutions#VC#Innovations#Web#Data#Efficiency#BugReporting#DigitalTransformation#Kamiwaza#Beams

Venture Village Wall 🦄

@venturevillagewall · Post #3360 · 18.12.2024 г., 12:07

Gander Raises $500K for AI Solutions Gander has secured a funding round of $500K, announced for December 4, 2024. The company focuses on assisting airlines in creating flexible, AI-powered workflows that enable customers to request reimbursements and compensation efficiently. #Funding#AI#Airlines#Reimbursement#Compensation#Workflows#Finance#Tech#Innovation#CustomerService#Gander#Investment#Startup#Digital#Support#Flexibility#Solutions#Technology#Efficient#CustomerExperience