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

Резултати

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

Пребарај: #oauth2

当前筛选 #oauth2清除筛选
GitHub Trends

@githubtrending · Post #14663 · 02.05.2025 г., 12:30

#python#agents#ai#ai_agents#api#developer_tools#function_calling#integration#llm#mcp#oauth2#open_source#permissions#tools ACI.dev is an open-source platform that helps build AI agents by providing easy access to over 600 tools. It simplifies authentication and tool integration, allowing AI agents to work with many services like Google Calendar and Slack without needing separate setups. This platform offers multi-tenant authentication, flexible access methods, and natural language permissions, making it easier to manage and secure AI agent capabilities. It's open-source and works with any framework, which means you can build AI agents without worrying about vendor lock-in. https://github.com/aipotheosis-labs/aci

GitHub Trends

@githubtrending · Post #15214 · 12.10.2025 г., 11:30

#python#agents#ai#ai_agents#api#developer_tools#discord#function_calling#integration#llm#mcp#mcp_client#mcp_server#oauth2#open_source Klavis AI helps developers connect AI tools to other services like GitHub, Gmail, and Slack easily. It offers hosted servers that handle authentication and client code automatically, making it simpler to integrate AI with various platforms. This saves time and effort by eliminating the need for custom authentication management and client library maintenance. Users can quickly set up and scale their AI applications without worrying about complex integrations, making it easier to deploy AI-powered workflows securely and efficiently. https://github.com/Klavis-AI/klavis

GitHub Trends

@githubtrending · Post #15556 · 12.03.2026 г., 12:30

#typescript#ai#ai_agents#coding#deno#embeddings#insforge#nextjs#oauth2#pgvector#postgresql#realtime#vectors#websockets InsForge is an open-source backend platform for AI coding agents, offering easy auth, Postgres database, S3 storage, edge functions, and model gateway via a simple semantic layer. Agents fetch context, configure services, and inspect state to build full-stack apps quickly. Set up locally with Docker or use cloud deploys. It boosts agent accuracy 1.7x, speed 1.6x, and cuts tokens 30% vs. rivals, letting you prototype and ship AI-driven apps faster with less hassle and cost. https://github.com/InsForge/InsForge

GitHub Trends

@githubtrending · Post #14691 · 10.05.2025 г., 00:00

#csharp#architecture#aspnetcore#clean_architecture#cqrs#ddd#dotnet#dotnetcore#event_driven_architecture#event_sourcing#kubernetes#masstransit#messaging#microservice#microservices#oauth2#opentelemetry#software_architecture#software_design#software_engineering#vertical_slice_architecture Migrating from a monolithic architecture to a cloud-native microservices architecture offers several benefits. It improves scalability, allowing different parts of the application to grow independently. This approach also enhances reliability by isolating faults, so if one service fails, others continue to work. Additionally, microservices enable faster deployment and updates, as each service can be developed and deployed separately. This flexibility allows teams to use the best technology for each service, making development more efficient and agile[2][3][5]. https://github.com/meysamhadeli/monolith-to-cloud-architecture