Skip to content

feat(state): Enable :set tables - #1064

Merged
runkelcorey merged 1 commit into
masterfrom
feat-state-change-table-type
Aug 5, 2026
Merged

feat(state): Enable :set tables#1064
runkelcorey merged 1 commit into
masterfrom
feat-state-change-table-type

Conversation

@runkelcorey

@runkelcorey runkelcorey commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

🐞 State.StopEvent times out on refresh

This PR adds the option of making a :set table instead of a :bag. For conservatism, I opted for only allowing :set and :bag.

Insert and lookup times in tables of type set are constant, regardless of the table size. For table types bag and duplicate_bag time is proportional to the number of objects with the same key.

After deploying to dev-blue, Splunk showed that the init_table log time (which approximates the full reload) dropped 27% against dev-green, the baseline:

measure dev-green dev-blue 𝚫
5th percentile 6,442ms 5,952ms -8%
median 13,347ms 9,695ms -27%
95th percentile 16,336ms 14,589ms -10%

This change won't eliminate the issue entirely—9.6s is still much longer than it takes to reload Prediction—so I'm working on more PRs to address the issue.

@runkelcorey runkelcorey added the enhancement New feature or request label Aug 4, 2026
@runkelcorey runkelcorey self-assigned this Aug 4, 2026
@runkelcorey
runkelcorey marked this pull request as ready for review August 5, 2026 17:26
@runkelcorey
runkelcorey requested a review from a team as a code owner August 5, 2026 17:26
@runkelcorey
runkelcorey requested review from lemald and removed request for a team August 5, 2026 17:26
@lemald

lemald commented Aug 5, 2026

Copy link
Copy Markdown
Member

Interesting! So were there a lot of StopEvents with the same key? That would explain the poor performance with a :bag table type, but then wouldn't that imply that there will be a problem with the :set table type due to :set only allowing one value per key?

@runkelcorey

Copy link
Copy Markdown
Contributor Author

Interesting! So were there a lot of StopEvents with the same key? That would explain the poor performance with a :bag table type, but then wouldn't that imply that there will be a problem with the :set table type due to :set only allowing one value per key?

No, the id is unique and enforced in lamp. I think the insert performance is not only proportional to the number of objects with the same key but, by implication, the number of objects. Also, perhaps other performance is also affected by table type?

@lemald lemald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, makes sense. I wish we had a slightly more certain story about what's improving the performance, but since this is a very targeted change that only applies to StopEvents I'm okay with merging it.

@runkelcorey
runkelcorey merged commit 56a8803 into master Aug 5, 2026
51 checks passed
@runkelcorey
runkelcorey deleted the feat-state-change-table-type branch August 5, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants