Skip to content

PERF: remove useless calls to count() in core classes, tpls and modulebuilder template#34376

Closed
marc-dll wants to merge 4 commits intoDolibarr:18.0from
marc-dll:18.0_PERF_count_core
Closed

PERF: remove useless calls to count() in core classes, tpls and modulebuilder template#34376
marc-dll wants to merge 4 commits intoDolibarr:18.0from
marc-dll:18.0_PERF_count_core

Conversation

@marc-dll
Copy link
Contributor

@marc-dll marc-dll commented Jun 8, 2025

PERF: remove useless calls to count() in core classes, tpls and modulebuilder template

Dolibarr is filled with calls to function count() whose result is simply compared to 0 (to see if the passed array is empty or not) or below a certain value. This loses a lot of time because under the hood, time is spent needlessly to really return the number of elements.

I searched for any call to count in main core Dolibarr classes, tpls, and in the modulebuilder template, and replaced those calls (mostly using empty() or replacing for with foreach) where necessary.

@eldy
Copy link
Member

eldy commented Jun 8, 2025

As this is refactoring, this must be pushed into develop branch.
Only bug fixes can be pushed in already released version.

@eldy eldy added the PR no feature/refacto into freezed/released branch PR can't be accepted because it's a feature change or refactoring pushed into a stable frozen branch label Jun 8, 2025
@eldy eldy changed the base branch from 18.0 to develop October 2, 2025 00:37
@eldy eldy changed the base branch from develop to 18.0 October 2, 2025 00:38
@eldy
Copy link
Member

eldy commented Oct 2, 2025

PR could not be merged into develop branch, so i close it.

@eldy eldy closed this Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR no feature/refacto into freezed/released branch PR can't be accepted because it's a feature change or refactoring pushed into a stable frozen branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants