Skip to content

Efficient signatures for patterns - #1270

Open
s5bug wants to merge 7 commits into
FallingColors:1.21from
s5bug:efficient-signature
Open

Efficient signatures for patterns#1270
s5bug wants to merge 7 commits into
FallingColors:1.21from
s5bug:efficient-signature

Conversation

@s5bug

@s5bug s5bug commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

This needs an extra set of eyes and a bit of bug testing because I wrote all this while tired and hungry

Continuation of #1260, much thanks to @YukkuriC for the inspiration and motivation

@s5bug
s5bug force-pushed the efficient-signature branch from 3e37423 to de81d90 Compare August 17, 2026 20:46
@s5bug

s5bug commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

I would like to mention that due to object padding, HexSignature actually has room on it to store a cached Action. However, I don't know if it's safe to do that: I don't know where serialization boundaries are / what would happen if someone rerolled per-world patterns while a Signature had an old Action cached.

If it would be safe to do that, please let me know so I can implement it :)

@s5bug

s5bug commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

The other option (mentioned in Discord but not here) is to use that extra four bytes for int size; to not have to use TURNS_PER_ARRAY_ELEMENT * packedTurns.length. However, there's nothing that explicitly depends on the exact stroke count of a pattern to my knowledge.

return this;
}

public HexSignature build() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't have time to do it right now, but I need to remember to document properly that build can be called multiple times and reset can be used to not have to re-allocate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

1 participant