<feed xmlns='http://www.w3.org/2005/Atom'>
<title>catch3/src/catch2/internal/catch_clara.hpp, branch 0.2.0</title>
<subtitle>Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.</subtitle>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/'/>
<entry>
<title>Add some missing CATCH_MOVEs</title>
<updated>2026-09-11T09:27:33+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2026-09-11T07:41:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=b7f1a83ff0c36990a9840bcb3de56a848d24a893'/>
<id>b7f1a83ff0c36990a9840bcb3de56a848d24a893</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use template variables for our trait-likes in Clara</title>
<updated>2025-07-15T09:49:39+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2025-07-15T09:49:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=b9c018b38a98f7f9d15e4f6b9e60ec90cd393b7b'/>
<id>b9c018b38a98f7f9d15e4f6b9e60ec90cd393b7b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix adding Opts with | to lvalue Parser</title>
<updated>2024-01-02T22:27:13+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2024-01-02T22:27:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=863c662c0eff026300f4d729a7054e90d6d12cdd'/>
<id>863c662c0eff026300f4d729a7054e90d6d12cdd</id>
<content type='text'>
This is the recommended way of adding new Opts in our documentation
for using custom main, but we did not compile the code to see if it
works. We now compile the example as part of the BUILD_EXAMPLES
option.

Fixes #2787
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the recommended way of adding new Opts in our documentation
for using custom main, but we did not compile the code to see if it
works. We now compile the example as part of the BUILD_EXAMPLES
option.

Fixes #2787
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid copying TokenStreams while parsing</title>
<updated>2023-12-27T20:14:12+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-27T20:11:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=eaafd076743407e930a11297425f33c1f78220b0'/>
<id>eaafd076743407e930a11297425f33c1f78220b0</id>
<content type='text'>
The code is now even worse mess than before, due to the ad-hoc
implementation of Result-ish type based on virtual functions in
Clara, but it has dropped the allocations for empty binary down
to 151.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The code is now even worse mess than before, due to the ad-hoc
implementation of Result-ish type based on virtual functions in
Clara, but it has dropped the allocations for empty binary down
to 151.
</pre>
</div>
</content>
</entry>
<entry>
<title>Args and TokenStream use StringRefs instead of std::strings</title>
<updated>2023-12-27T15:24:33+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-27T15:19:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=5d637d4c6b72dc21e2e198894ba0527729fba535'/>
<id>5d637d4c6b72dc21e2e198894ba0527729fba535</id>
<content type='text'>
Because TokenStream is copied around a lot, moving it to use
`StringRef` removes _a lot_ of allocations per `Opt` in the parser.
Args are not copied around much, but changing them as well makes it
obvious that they do not participate in the ownership.

The changes add up to removing ~180 allocations for "empty"
invocation of the test binary.
(`./tests/ExtraTests/NoTests --allow-running-no-tests -o /dev/null`
is down to 317 allocs)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Because TokenStream is copied around a lot, moving it to use
`StringRef` removes _a lot_ of allocations per `Opt` in the parser.
Args are not copied around much, but changing them as well makes it
obvious that they do not participate in the ownership.

The changes add up to removing ~180 allocations for "empty"
invocation of the test binary.
(`./tests/ExtraTests/NoTests --allow-running-no-tests -o /dev/null`
is down to 317 allocs)
</pre>
</div>
</content>
</entry>
<entry>
<title>Use StringRef for Opt's optNames</title>
<updated>2023-12-26T15:03:22+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-26T13:01:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=cd3c7ebe873c3da91ce57c6b2221ba95ee7f93e6'/>
<id>cd3c7ebe873c3da91ce57c6b2221ba95ee7f93e6</id>
<content type='text'>
Removes another ~70 allocations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Removes another ~70 allocations.
</pre>
</div>
</content>
</entry>
<entry>
<title>Enable moving Opts into Parser</title>
<updated>2023-12-26T14:41:07+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-26T10:57:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=5d5f42f99b7409b6b051182fae69fd22f8877a6d'/>
<id>5d5f42f99b7409b6b051182fae69fd22f8877a6d</id>
<content type='text'>
This also required keeping the reference type in the fluent interface
for Opts.

Removes another ~40 allocations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This also required keeping the reference type in the fluent interface
for Opts.

Removes another ~40 allocations.
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid copying Clara::Parser for every inserted Opt</title>
<updated>2023-12-26T14:11:48+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-26T10:55:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=c57e349d1d62fcdf96aef576a5c200ae2078daad'/>
<id>c57e349d1d62fcdf96aef576a5c200ae2078daad</id>
<content type='text'>
This prevents the full construction from being O(N^2) in number
of `Opt`s, and also reduces the number of allocations for running
no tests significantly:

`tests/SelfTest`: 7705 -&gt; 6095
`tests/ExtraTests/NoTests` 2215 -&gt; 605
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This prevents the full construction from being O(N^2) in number
of `Opt`s, and also reduces the number of allocations for running
no tests significantly:

`tests/SelfTest`: 7705 -&gt; 6095
`tests/ExtraTests/NoTests` 2215 -&gt; 605
</pre>
</div>
</content>
</entry>
<entry>
<title>Cleanup help string construction in Clara</title>
<updated>2023-12-26T13:57:29+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-23T15:06:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=822c44a20395c6194d527110d59f7513a55b885c'/>
<id>822c44a20395c6194d527110d59f7513a55b885c</id>
<content type='text'>
* Clara::Opt::getHelpColumns returns single item

  It could never return multiple items, but for some reason it
  was wrapping that single item in a vector.

* Use ReusableStringStream in Clara
* Reserve HelpColumns ahead of time
* Use StringRef for descriptions in HelpColumn type

The combination of these changes ends up removing about 7% (~200)
of allocations when Catch2 has to prepare output for `-h`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Clara::Opt::getHelpColumns returns single item

  It could never return multiple items, but for some reason it
  was wrapping that single item in a vector.

* Use ReusableStringStream in Clara
* Reserve HelpColumns ahead of time
* Use StringRef for descriptions in HelpColumn type

The combination of these changes ends up removing about 7% (~200)
of allocations when Catch2 has to prepare output for `-h`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Store Opt/Arg hint and description as StringRef</title>
<updated>2023-12-26T13:40:45+00:00</updated>
<author>
<name>Martin Hořeňovský</name>
</author>
<published>2023-12-23T15:02:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.progmasoft.com/catch3/commit/?id=2295d2c8ccc0dba4b35adb95ef8946a05996df87'/>
<id>2295d2c8ccc0dba4b35adb95ef8946a05996df87</id>
<content type='text'>
There is no good reason for these to be std::strings, as these
are just (optional) constants for nice user output. This ends up
reducing the allocations significantly.

When measuring allocations when running no tests, the changes are
`tests/SelfTest` 9213 -&gt; 7705
`tests/ExtraTests/NoTests` 3723 -&gt; 2215
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is no good reason for these to be std::strings, as these
are just (optional) constants for nice user output. This ends up
reducing the allocations significantly.

When measuring allocations when running no tests, the changes are
`tests/SelfTest` 9213 -&gt; 7705
`tests/ExtraTests/NoTests` 3723 -&gt; 2215
</pre>
</div>
</content>
</entry>
</feed>
