0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code用 C++17で高性能コード解析エンジン youtube 動画アップ

Posted at

背景・動機

  • Claude Code などのAI開発で高速なコード解析が必要

  • Python版は大規模プロジェクトで性能限界

  • 10-100倍の性能改善を目指して C++17 で再実装

技術選択

パーサー選択

  • std::regex → PEGTL (Parsing Expression Grammar Template Library)

  • 正規表現地獄からの脱出

並列処理設計

  • std::execution::par_unseq 活用

  • I/Oスレッド数制御 (--io-threads)

  • CPUバウンド処理の最適化

実装の工夫点

言語別ハイブリッド戦略

  • TypeScript: PEGTL + 文字列解析フォールバック

  • C++: テンプレート・マクロ解析対応

  • Python: インデント構文の特殊処理

メモリ効率化

  • セッション管理による180倍高速化

  • キャッシュ戦略

成果・実測結果

| プロジェクト | ファイル数 | 検出関数数 | 処理時間 |

|-------------|-----------|-----------|---------|

| TypeScript Compiler | 735ファイル | 2,362関数 | 1.9分 |

| lodash.js | 1ファイル | 489関数 | 0.7秒 |

| nlohmann/json | 1ファイル | 254関数 | 0.5秒 |

学んだこと

  • 正規表現の限界と代替手法

  • C++17並列処理の実用性

  • 言語特性に応じた解析戦略の重要性

今後の展望

  • さらなる言語サポート

  • Claude Code専用最適化

ソースコード

GitHub: https://github.com/moe-charm/nekocode

動画デモ

実際の動作はこちら: https://www.youtube.com/watch?v=I9Nij1KgTPw

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?