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

Резултати

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

Пребарај: #graphql

当前筛选 #graphql清除筛选
Repositorio data science

@repo_science · Post #3204 · 19.05.2023 г., 03:28

#databases#GraphQL 💾 Building Web APIs with GraphQL - The Complete Guide Become an expert in one of the most exciting web APIs framework with this practical, hands-on course 🔗Link ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

infosecurity

@tg_infosec · Post #2744 · 05.12.2024 г., 08:29

🔒 API Security Academy. • По ссылке ниже можно найти бесплатную коллекцию заданий, которые научат Вас атаковать и защищать приложения, использующие GraphQL. • Академия предоставляет подробные уроки, из которых Вы узнаете о различных уязвимостях и передовых методах обеспечения защиты. Список доступных уроков: - Prevent Mutation Brute-Force Attacks; - Implement Object-Level Authorization; - Disable Debug Mode for Production; - Combat SQL Injections; - Limit Query Complexity; - Implement Field-Level Authorization; - Configure HTTP Headers for User Protection; - Validate JSON Inputs; - Implement Resolver-Level Authorization. В будущем будут опубликованы и другие уроки: - Mitigate Server Side Request Forgery; - Implement Rate-Limiting for Bot Deterrence; - Abort Expensive Queries for Protection; - Configure a Secure API Gateway; - Limit Query Batching to Safeguard Resources; - Implement List Pagination; - Secure Third-Party API Interactions. #API#GraphQL

Hashtags

Repositorio data science

@repo_science · Post #3132 · 03.05.2023 г., 21:58

#GraphQL#apiRest 🎛 ¿Qué es GraphQL? ¿Es un reemplazo para la API REST? El siguiente diagrama muestra una comparación rápida entre REST y GraphQL. 🔹 GraphQL es un lenguaje de consulta para API desarrollado por Meta. Proporciona una descripción completa de los datos en la API y brinda a los clientes el poder de pedir exactamente lo que necesitan. 🔹Los servidores GraphQL se encuentran entre el cliente y los servicios de back-end. 🔹 GraphQL puede agregar múltiples solicitudes REST en una consulta. El servidor GraphQL organiza los recursos en un gráfico. 🔹 GraphQL admite consultas, mutaciones ( que aplican modificaciones de datos a recursos ) y suscripciones ( que reciben notificaciones sobre modificaciones del esquema ). ----- Canal principal:@repo_science Cupones:@freecoupons_reposcience -----

Repositorio data science

@repo_science · Post #3678 · 26.10.2023 г., 21:40

#webDevelopment#MERNStack#GraphQL 🌐 MERN Stack And GraphQL Complete Guide With BLOG Project 2023 Description Welcome to the comprehensive MERN Stack and GraphQL Complete Course on Udemy! Whether you’re a beginner or an experienced developer, this course will take you on a journey from the very basics to building a fully functional real-world application. In this course, we’ll start by laying a solid foundation in the MERN Stack (MongoDB, Express.js, React, Node.js). You’ll learn how to set up your development environment, understand the core concepts of each technology, and gain hands-on experience with practical examples and exercises, and deployment. ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

GitHub Trends

@githubtrending · Post #14862 · 24.06.2025 г., 13:00

#typescript#codemirror#graphiql#graphql#lsp_mode#lsp_server#monaco_editor#vscode GraphiQL is a powerful, open-source GraphQL IDE that helps you write, test, and explore GraphQL queries easily in your browser or desktop. It offers features like syntax highlighting, live error checking, and schema exploration, making it simpler to work with GraphQL APIs. The project is part of a monorepo that includes tools for different editors like CodeMirror and Monaco, providing a consistent and extensible development experience. Using this monorepo setup improves collaboration, code sharing, and maintenance across related tools, saving you time and effort when building or extending GraphQL IDEs. This means you get a reliable, efficient environment to develop GraphQL applications faster and with fewer errors. https://github.com/graphql/graphiql

GitHub Trends

@githubtrending · Post #15510 · 20.02.2026 г., 13:00

#go#ai_agents#ai_security_tool#anthropic#autonomous_agents#golang#gpt#graphql#multi_agent_system#offensive_security#open_source#openai#penetration_testing#penetration_testing_tools#react#security_automation#security_testing#security_tools#self_hosted PentAGI is an AI-powered tool that automates penetration testing with smart agents using 20+ pro tools like nmap and metasploit in a safe Docker sandbox. It researches vulnerabilities, executes attacks, stores knowledge for reuse, and creates detailed reports via a simple web UI. Quick setup needs Docker, an LLM API key (OpenAI/Anthropic), and `docker compose up -d`. This saves you hours of manual work, speeds up secure testing, cuts errors, and helps find issues faster for better protection. https://github.com/vxcontrol/pentagi

12
ПретходнаСтраница 1 од 2Следна