Skip to content

Avoid repeated sorting and observation copies in TPE model construction - #281

Merged
y0z merged 1 commit into
mainfrom
perf/issue-270-model-columns
Oct 15, 2026
Merged

y0z merged 1 commit into
mainfrom
perf/issue-270-model-columns

Conversation

@y0z

@y0z y0z commented Oct 15, 2026

Copy link
Copy Markdown
Member

Reuse the sorted observation view when building TPE models, avoiding repeated parameter-name sorting and temporary observation/distribution maps. Build categorical index buffers directly from selected rows while sharing model construction with the named-observation API and retaining borrowing for numerical slices.

Closes #270.

Original implementation by @tkng, cherry-picked from 0ec3628 without code changes, preserving the original commit author.

…struction

TPE already prepares observation columns in sorted parameter order.
Building the good and poor models sorts the same names again and creates
temporary observation and distribution maps. Categorical values are also
copied into temporary float buffers before conversion to category indices.

Pass one sorted view of names, distributions, and observation columns to
both model builders. Construct category-index buffers directly from the
selected rows and retain the parameter order through mixture construction.
This removes repeated sorting, temporary maps, and intermediate copies.
@y0z
y0z marked this pull request as ready for review October 15, 2026 07:28
@y0z
y0z merged commit 259c747 into main Oct 15, 2026
8 checks passed
@y0z
y0z deleted the perf/issue-270-model-columns branch October 15, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multivariate TPE model construction repeats name sorting and observation copying

2 participants