Skip to content

java: Optimize Location #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 30, 2025
Merged

java: Optimize Location #385

merged 6 commits into from
Mar 30, 2025

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Mar 30, 2025

🤔 What's changed?

Separating out the elements from #372 that involve Location

  • Replaced io.cucumber.gherkin.Location with io.cucumber.messages.types.Location to reduce creation of temporary objects.

  • Ensure Token.location is non-null.

  • Location instances are created through Locations utility allowing for reuse of Long objects.

  • Pre-create Long objects for 0 through 4000 to avoid churn while parsing.

⚡️ What's your motivation?

Fixes: cucumber/cucumber-jvm#2985

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, etc. without changing behaviour)

📋 Checklist:

Separating out the elements from #372 that involve Location

* Replaced `io.cucumber.gherkin.Location` with
  `io.cucumber.messages.types.Location` to reduce creation of temporary
  objects.

* Ensure `Token.location` is non-null.

* `Location` instances are created through `Locations` utility allowing
  for reuse of `Long` objects.

* Pre-create `Long` objects for 0 through 4000 to avoid churn while
  parsing.

Fixes: #384
@mpkorstanje mpkorstanje requested a review from jkronegg March 30, 2025 14:17
@mpkorstanje mpkorstanje merged commit bdbe821 into main Mar 30, 2025
4 checks passed
@mpkorstanje mpkorstanje deleted the java-optimize-location branch March 30, 2025 14:25
jkronegg pushed a commit that referenced this pull request Apr 2, 2025
jkronegg pushed a commit that referenced this pull request Apr 2, 2025
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.

Codegen generates inefficient Java code for Long and Boolean mandatory parameters
1 participant