Skip to content

Conversation

@APickledWalrus
Copy link
Member

Problem

In #8316, a feature was implemented so that the Origin of a syntax can be automatically determined (as what addon is providing it) if not set. However, this change means that our rule that when two syntaxes share a Priority, any syntax from Skript itself comes first is leading to some slowdowns. This is due to the fact that Skript has some costly patterns that are using default priorities (rather than forcing themselves to occur later).

Additionally, the patterns property of SyntaxInfo is currently represented by a Collection. However, ordering is an important part of writing syntax (e.g. matchedPattern in init), meaning the current typing is too loose.

Solution

I have implemented a basic system to estimate the priority of a Syntax based on the definitions of the predefined (standard) priorities:

  • SIMPLE means the pattern contains no expressions
  • COMBINED means the pattern contains one or more expressions
  • PATTERN_MATCHES_EVERYTHING means the pattern contains multiple expressions directly next to each other (e.g. EffTree: (grow|create|generate) %structuretype% %directions% %locations%)
    This check is not intended to be extensive, but to instead cover most general use cases (i.e. you should not generally have to provide a priority). Of course, for specific patterns (maybe where regular expressions are involved, for example), it is still recommended explicitly specify a priority.

Now that we are using Java 21, SequencedCollection is now available to us, and it is exactly what we need for something like patterns, where ordering is important, but random access is not. I have updated patterns to use this type. I have also updated since and description of BukkitSyntaxInfos.Event to use this, as ordering is relevant for those two properties. This should not impact existing code since SequencedCollection is a subtype of Collection.

Testing Completed

Local testing demonstrated significant improvements for affected syntax. There does not seem to be any negative impact, though I would like to test with more expansive setups.

Supporting Information

n/a


Completes: none
Related: none
AI assistance: none

@APickledWalrus APickledWalrus added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jan 6, 2026
@APickledWalrus APickledWalrus requested review from a team as code owners January 6, 2026 22:00
@APickledWalrus APickledWalrus added the 2.14 Targeting a 2.14.X version release. label Jan 6, 2026
@APickledWalrus APickledWalrus requested review from Absolutionism, UnderscoreTud and cheeezburga and removed request for a team January 6, 2026 22:00
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.14 Targeting a 2.14.X version release. enhancement Feature request, an issue about something that could be improved, or a PR improving something. needs reviews A PR that needs additional reviews

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants