Skip to content

perf: оптимизация tag-проверок на горячих путях — сокращение избыточных pmm_resolve (Этап 10.3, Issue #207)#224

Merged
netkeep80 merged 3 commits into
netkeep80:mainfrom
konard:issue-207-74dc2dfe1dcb
Mar 22, 2026
Merged

perf: оптимизация tag-проверок на горячих путях — сокращение избыточных pmm_resolve (Этап 10.3, Issue #207)#224
netkeep80 merged 3 commits into
netkeep80:mainfrom
konard:issue-207-74dc2dfe1dcb

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Mar 22, 2026

Summary

  • Оптимизированы горячие пути в pjson_node.h, pjson_db_helpers.h, pjson_db_pmm.h для сокращения избыточных вызовов pmm_resolve<node>()
  • is_number(): единственный tag() вместо трёх отдельных вызовов (через is_integer(), is_uinteger(), is_real())
  • is_null(): убрана избыточная проверка is_error() (уже обрабатывается внутри tag())
  • deref(): единственный pmm_resolve за итерацию вместо отдельных is_ref() + ref_target()
  • pjson_traverse_subtree / pjson_traverse_subtree_postorder: единственный tag() вместо цепочки is_array() + is_object()
  • pjson_free_node_visitor: используется n->tag напрямую вместо повторного v.tag()
  • pjson_count_visitor: единственный pmm_resolve для получения тега и данных
  • _walk_path() и erase(): единственный tag() вместо цепочки is_object() + is_array()
  • Добавлены 14 тестов в tests/test_pjson_tag_opt.cpp
  • Обновлены plan.md и readme.md

Контекст

Это Этап 10.3 (Проблема 10) из plan.md. Каждый вызов is_string(), is_array(), is_number() и т.д. вызывал tag(), который выполнял pmm_resolve<node>(id). При цепочке проверок один и тот же узел разрешался многократно. Теперь на каждом горячем пути выполняется единственный resolve.

Fixes

Fixes #207

Test plan

  • Все 690 тестов проходят (676 существующих + 14 новых)
  • 14 новых тестов: is_number (4), is_null (4), deref (3), erase (1), walk_path (1), traversal (1)
  • Сборка без ошибок (только предупреждения из deps/pmm/pmm.h)
  • clang-format проверен

🤖 Generated with Claude Code

konard and others added 2 commits March 22, 2026 09:15
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: netkeep80#207
…ых pmm_resolve (Этап 10.3, Issue netkeep80#207)

Оптимизированы горячие пути для сокращения избыточных вызовов pmm_resolve<node>():
- is_number(): единственный tag() вместо трёх отдельных вызовов
- is_null(): убрана избыточная проверка is_error()
- deref(): единственный pmm_resolve за итерацию
- pjson_traverse_subtree/postorder: единственный tag() вместо is_array()+is_object()
- pjson_free_node_visitor: n->tag напрямую вместо повторного v.tag()
- pjson_count_visitor: единственный pmm_resolve для тега и данных
- _walk_path()/erase(): единственный tag() вместо is_object()+is_array()

Добавлены 14 тестов. Все 690 тестов проходят.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Сделать следующую задачу в текущей фазе разработки и после обновить README.md и файл фазы разработки perf: оптимизация tag-проверок на горячих путях — сокращение избыточных pmm_resolve (Этап 10.3, Issue #207) Mar 22, 2026
@konard konard marked this pull request as ready for review March 22, 2026 09:30
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 22, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $9.912684
  • Calculated by Anthropic: $6.463650 USD
  • Difference: $-3.449033 (-34.79%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (2819KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented Mar 22, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@netkeep80 netkeep80 merged commit b7989b9 into netkeep80:main Mar 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants