تخطَّ إلى المحتوى
TakoAPI
العودة إلى المهارات

neo-py-memory-optimizer

بواسطة martinforsulu

Notes & PKM
—لم يُقيَّم بعد
تقييمك

موجز

Automatically analyzes Python code and suggests memory usage optimizations for improved performance.

الوصف

ما الذي تفعله هذه المهارة

Analyzes Python source files using AST-based static analysis to detect memory-intensive patterns, potential leaks, and inefficient code. Returns findings with line numbers, severity ratings, and concrete optimization suggestions including estimated memory savings.

Catches memory issues without running the code, so it works in CI pipelines or on code that is expensive or unsafe to execute.

متى تستخدمها

  • Auditing a Django app before deploying to a memory-constrained server
  • Finding unclosed file handles in a data processing script
  • Converting large list comprehensions to generators in batch jobs
  • Generating a memory optimization report for a code review
  • Scanning a legacy codebase recursively for circular reference risks

مثال على سير العمل

الإدخال

User asks: Analyze this Python script for memory issues and show suggestions with estimated savings

الوكيل
  1. 1

    Receives the Python source code from the user

  2. 2

    Invokes py-memory-optimizer analyze on the provided file with --show-suggestions --estimate-savings flags

  3. 3

    AST parser scans the code for patterns: large list comprehensions, unclosed resources, global variable accumulation

  4. 4

    Ranks findings by severity (critical, high, medium, low) and attaches line numbers

  5. 5

    Compiles per-issue optimization suggestions with code examples and estimated savings percentages

الإخراج

Structured report listing each memory issue by line number, its severity, a description of the pattern, a corrected code snippet, and an estimated memory savings range

التثبيت

clawhub install martinforsulu/neo-py-memory-optimizer

شغّل أمر واجهة سطر الأوامر، أو الصق النص في Claude Code أو Cursor أو Codex أو أي وكيل برمجة تستخدمه.

الروابط