Skip to content

Conversation

@jquorning
Copy link
Contributor

No description provided.

Comment on lines +142 to +144
------------------
-- Format_Input --
------------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen a lot of Ada with blocks like this, but I find it incredibly distracting, especially when renaming the subprogram will likely result in needing to modify this comment header as well.

declare
US : constant ASU.Unbounded_String := V ( Positive (Index));
S : constant String := ASU.To_String (US);
-- US : constant String := V ( Positive (Index));
Copy link
Owner

@pyjarrett pyjarrett Jun 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed.

New_Min : constant Positive := Positive'Max (A.Minimum, B.Minimum);
New_Max : constant Positive := Positive'Min (A.Maximum, B.Maximum);
use Ada.Strings.Unbounded;
-- use Ada.Strings.Unbounded;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed.

end if;
end loop;

return To_String (Result);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it results in an additional copy to the stack on every call to this function.

@pyjarrett
Copy link
Owner

This changes 10% of the code base. What is the purpose of this change? Does it result in a measurable performance increase (as seen with perf or another tool)? If you want to target segments of the codebase at a time that's fine, but I'm not going to do an en masse replacement since a lot of manual testing is involved.

Yes, there is a lot of copying between String and Unbounded_String. The change to remove this from Matches_File looks good, but Unbounded_String is a copy-on-write type implemented by GNAT, it makes more sense to plumb that from end-to-end, since there's a lot of To_String <-> To_Unbounded_String flips in some codepaths.

General comments about this project's style:

  • it doesn't use comment blocks like this, as I find them very distracting, I know some Ada projects do this, there are some parts where I added extra long comment lines (like ------------.....).
  • Avoid local use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants