acedrg_tables: extract insert_bond_row / insert_angle_row - #438
Open
pemsley wants to merge 1 commit into
Open
Conversation
Extract the inline per-row index-insertion logic from load_bond_tables() and load_angle_tables() into two public methods, insert_bond_row() and insert_angle_row(), and point the loaders at them. This deduplicates the key construction and gives external code a way to populate the bond/angle index containers row by row (e.g. an on-demand backend feeding fill_restraints without bulk-loading the whole table set). The scratch key buffers are passed in by the caller and reused across rows, avoiding per-row allocations that the old inline code made. Behaviour-preserving: gemmi drg output is byte-identical before and after for ALA, ASN, ATP, CQ8, GLC, NAG, PLP and STI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extract the inline per-row index-insertion logic from load_bond_tables() and load_angle_tables() into two public methods, insert_bond_row() and insert_angle_row(), and point the loaders at them.
This deduplicates the key construction and gives external code a way to populate the bond/angle index containers row by row (e.g. an on-demand backend feeding fill_restraints without bulk-loading the whole table set). The scratch key buffers are passed in by the caller and reused across rows, avoiding per-row allocations that the old inline code made.
Behaviour-preserving: gemmi drg output is byte-identical before and after - tested against a handful of monomers.