Skip to content

Performance optimisations - #32

Open
mwsis wants to merge 110 commits into
devfrom
perf-optimisations
Open

mwsis wants to merge 110 commits into
devfrom
perf-optimisations

Conversation

@mwsis

@mwsis mwsis commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

synesissoftware and others added 30 commits August 9, 2026 15:19
* Updated all `\param` and `\retval` Doxygen documentation comments in
  `cstring.h`, `cstring.vector.h`, and `cstring.core.c` to obey the 76-rule
  and terminate with a semicolon;
* Bumped version to 4.0.15 in `cstring.h`, `Doxyfile`, `CHANGES.md`, and
  `NEWS.md`;
* Updated `Updated:` header banners to 6th September 2026;
Give the 28 in-wave C/C++ projects (and gold **c** / **cxx** / **c_cxx**
templates) a sorted **files.associations** union of all associations
found under **~/dev**;
Align library version macros to c-cpp-standards. Define MAJOR, MINOR,
PATCH, and ALPHABETA; compute PREFIX_VER by shifts; keep REVISION as a
skip-section alias of PATCH (target at column 60); retain named historical
VER_* constants only for comparison and documentation.
Add or normalise test/scratch/libver to print the hosting PREFIX_VER as
“Name: vM.m.p.ab (PREFIX_VER = 0x........)” and, when sibling public
headers are included, an “efferent dependencies:” block.
Move test/scratch/libver to test/scratch/versions and retarget the
executable as versions so C/C++ reporters match the Phase 3 freeze.
Add a Phase 3 gold version printer under test/scratch/versions, wire
it from the scratch parent list, and use CMake target/argv0 versions;
Use Dir=$(cd "$(dirname "$ScriptPath")" && pwd) so paths with spaces resolve
reliably; apply the same one-line fix across in-wave helper scripts
(prepare/build/clean/ctest/remove and run_all_*).
Add SisClr_* status colour (NO_COLOR, AlwaysUseColours, TTY gate),
--build-shared-libs, and a single cmake invoke with CMakeGeneratorArgs so
every -D is always passed; tidy prologue groups, quoting, and help text.
Initialise AlwaysUseColours from SIS_CMAKE_ALWAYS_USE_COLOURS /
SIS_ALWAYS_USE_COLOURS; let -A/--always-use-colours override NO_COLOR
(pre-scan args so help and errors are coloured).
Drop MSYSTEM→MinGW and MakeCmd; honour SIS_CMAKE_MINGW via
`sis_cmake_is_truey()`; add sis_cmake_build for -m; configure in-place with
-S/-B and || exit 1; tighten --mingw/--msvc-mt/--run-make help.
Replace MakeCmd/Makefile gating with sis_cmake_build; require a configured
CMakeCache; add SisClr_* colour and -A to match prepare_cmake.sh.
Replace MakeCmd/Makefile gating with sis_cmake_build clean; require a
configured CMakeCache; add SisClr_* colour and -A to match build_cmake.sh.
Add SisClr_* colour and -A; quote inventory loops; recognise Windows_NT;
remove artefacts without cd into the build directory.
Replace MakeCmd with sis_cmake_build; require CMakeCache; fail -M when
unconfigured; add --output-on-failure, SisClr_* colour, and -A.
Make run_all_unit_tests.sh unit-only; align both category runners with
SisClr_*/-A, cmake --build, and gold basename discovery (.exe, print0).
Replace per-iteration std::vector arenas with stlsoft::auto_buffer (512
stack elements) so sizes ≤256 avoid a heap alloc in the timed path; rename
scenario_borrowed_fixed to scenario_borrowed_fixed_assign to match the
measured operation.
GCC 15 with -Werror flags an inlined stlsoft::auto_buffer destructor as
freeing its internal buffer. Suppress -Wfree-nonheap-object on
test.performance.cstring; the destructor deallocates external storage
only.
test_unit_cstring_1 calls CoTaskMem* and CoGetMalloc. Hold a
comstl::com_init for the process, and skip arena size probes when an empty
string has a NULL pointer.
* misc

* chore(internal): removed `CSTRING_USE_WINAPI_` and now discriminate on `_WIN32`

* chore(internal): simplified includes

* refactor(cstring): centralise CSTRING_ASSERT in internal.h

Define CSTRING_ASSERT once in src/internal.h, with <assert.h>, and drop the
copies in cstring.core.c and cstring.vector.c. Vector call sites use that
macro in place of CSTRING_VECTOR_ASSERT. dllmain.c includes internal.h.

* fix
* dependencies

* misc

* test(cstring): show readline ignoring a failed readonly clear

Add a component case that passes a non-empty readonly cstring to
cstring_readline() for an empty line and for immediate EOF. The clear must
return CSTRING_RC_READONLY, leave the payload in place, and leave the
stream unconsumed.

* docs(cstring): record the 4.0.19 readonly readline clear

Describe the cstring_readline() truncate check in CHANGES.md and NEWS.md,
set Doxyfile PROJECT_NUMBER to 4.0.19, and date the cstring.core.c banner.
* dependencies

* chore(tests): canonicalised form

* refactoring(tests): canonicalised form

* tests(readline): more test cases

* refactor(readline): canonicalising tests

* fix(scripts): drop --verbosity from non-automated runners

Example, performance, and scratch runners do not take --verbosity and do
not pass it to the programs they launch. Each program is invoked with no
extra arguments. Unit and component runners still accept the flag and
forward it.

Apply the same change to the cstring runners and to the cmake-helpers
templates they are copied from.

* fix(cstring): count the newline in cstring_readline() numRead

Count every character read from the stream in numRead, including the
terminating newline. A CRLF's CR is still counted and still stripped from
the string. Previously that newline was omitted, so a line containing only
LF reported zero.

Add single-line LF and CRLF component cases and align the existing numRead
expectations. Record the correction as 4.0.19.

* chore(tests): simplified form(s)

* fix(cstring): treat CR, LF, and CRLF as cstring_readline terminators

Count every character read for the line in numRead, including the
terminator, and do not store CR or LF. A lone CR, including CR at end of
stream, ends the line with CSTRING_RC_SUCCESS and pushes the following
character back.

Add single-line LF, CRLF, and CR component cases. An embedded CR now splits
a cstring_vector_readLines line. Record the correction as 4.0.19.

* tests(readline): more test cases

* tests(readline): more test cases

* test(cstring): close readline temp files before reopen

xtests::temp_file creates its Windows file with an exclusive handle and
leaves that handle open. The readline component tests then fopen the same
path, which Windows rejects as a sharing violation. Pass CloseOnOpen so the
creating handle is closed before fopen.

Drop the local argc == 0 guard, which skipped the suite on every normal
invocation.

* fix

* fix
#39)

* test(cstring): shorten test directories and name cases in TEST_ form

Shorten test directories to the subject under test/<kind>/, and name each
CMake target test.<kind>.<subject>. Spell every case TEST_ in shouting
snake case, keeping each API or type in its real spelling, and switch
assertions to the terse xTests API.
- Drop empty cases and unused temp-file names;
- Rename **auto_buffer** to **cstring.borrowed**;
- Use `size_t` in the performance programs;
- Run CI on the **directories** branch.

* docs(cstring): complete the 4.0.19 release notes

Record post-4.0.18 behaviour and tests in **CHANGES.md** and **NEWS.md**;
Cover zero-size realloc frees and the readline performance suite;
borrowed-fixed scenarios, and shortened test directories with `TEST_`
names;

* chore(tests): refactored
…40)

Add **test.unit.cstring** as a C port of **test.unit.cstring.cxx**, and
shorten example and unit-test directories to the subject. Document memory
contracts, allocators, and a default-use sketch in **README.md**, and note
5.x SSO, vector-owned payloads, and a macOS dylib in **TODO.md**. Record
the split in **FAQ.md**, **NEWS.md**, and **CHANGES.md**.
@synesissoftware
synesissoftware changed the base branch from master to dev October 6, 2026 20:42
- Copy misc-dev-scripts 0.6.2 runners and merge prepare_cmake.sh, keeping
  the cstring -D flags and --gap-groups on the performance runners;
- Define CSTRING_VER_RELSTATUS as 0x81 (4.1.0-beta1) and alias
  CSTRING_VER_ALPHABETA to it;
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