Skip to content

Feature/optimize swapping - #153

Open
wvjgsuhp wants to merge 5 commits into
feature/speed-upfrom
feature/optimize-swapping
Open

wvjgsuhp wants to merge 5 commits into
feature/speed-upfrom
feature/optimize-swapping

Conversation

@wvjgsuhp

@wvjgsuhp wvjgsuhp commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

close #151

wvjgsuhp and others added 2 commits October 2, 2026 17:45
- Precompute each group's plot rows once per level (`plots_by_group()`,
  returned by `swappable_groups()` as `group_plots`).
- Swap factor codes and write the column back once, avoiding factor
  `==`/`[<-` label matching and data frame subsetting per iteration.
- Fix single-index `sample()` when picking a different treatment, and
  stop padding `swapped_items` with "" for skipped swaps.

Neighbour generation is 6-32x faster; end-to-end `speed()` ~1.25x, with
identical results for the same seed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wvjgsuhp
wvjgsuhp requested a review from rogerssam October 2, 2026 08:39
@wvjgsuhp
wvjgsuhp added this pull request to stack #157 October 7, 2026 03:03
@wvjgsuhp
wvjgsuhp removed this pull request from stack #157 October 7, 2026 03:13
@wvjgsuhp
wvjgsuhp added this pull request to stack #158 October 7, 2026 03:13

This branch has not been deployed

No deployments
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.

1 participant