mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1108] shader_library: move nested JSON values during parsing #1143
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1143
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1108
Author: @Kadamitas
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:perf/json-subtree-moves-continued📝 Commits (1)
f6ea7b6shader_library: move nested JSON values during parsing📊 Changes
1 file changed (+1 additions, -6 deletions)
View changed files
📝
runtime/src/shader_library.h(+1 -6)📄 Description
Claimed in the coordination issue as: RT-JSON-SUBTREE-MOVES (claim)
What and why
The explicitly defaulted destructor suppresses the implicit move constructor of
Json. Passing a parsed child to a vector withstd::movetherefore copies its strings and nested vectors. Growing an object or array can copy those subtrees again. Letting the compiler generate the destructor restores nonthrowing moves for bothJsonandJsonObjectEntry. The forward declaration still supports recursive object values.Tested
shader_library_testandmods_testpassed under MSVC x64, GCC 11.4 and Clang 18.1.8 with libstdc++. Clang 15 with libstdc++ 11 rejects the existing C++20 aggregate construction inemplace_backon both revisions.A synthetic input had 1,200 named entries, each with a label and four arrays of six small objects. Both builds produced 181,201 nodes and the same tree digest from the 1,141,381-byte document. Five interleaved release runs per revision under MSVC gave median parse times of 71.14 ms before and 17.46 ms after. Allocation counts fell from 822,984 to 176,419. File reads and digest calculation were outside the timed region.
git diff --checkandscripts/check_no_game_data.py runtime/src/shader_library.hpassed.The general translator suite ran 6,168 tests across 470 files with zero failing files.
GPUs tested: n/a, CPU-only JSON parsing.
AI-assisted: yes, Codex.
Checklist
mainand merges cleanly.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.