Skip to content

Some small optims#925

Merged
AltGr merged 2 commits intomasterfrom
comptims
Dec 18, 2025
Merged

Some small optims#925
AltGr merged 2 commits intomasterfrom
comptims

Conversation

@AltGr
Copy link
Contributor

@AltGr AltGr commented Dec 17, 2025

  • fast-path for string comparisons with the same pointer
  • improvement of equality expansion for constant constructors

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a sense of how much speed gain we get thanks to that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For expand_op, we should gain a lot in code size (and thus compilation / interpretation time): the code generated is now linear in size instead of quadratic in the number of constructors, when considering only the constant constructors. That could be life-saving for the cases that caused problem with OCaml's 244 constructors limitation.

For the string comparison, Vincent reported performance issues on sets and it should alleviate them, but I haven't benched yet (from reading the code, the missing fast-path was the main difference between our function and the OCaml built-in comparison ; but the latter is also based on memcmp which we can't compete with)

Base automatically changed from constantructor to master December 18, 2025 14:36
It is no longer quadratic on constant constructors, using direct comparison.
@AltGr AltGr merged commit 18b855e into master Dec 18, 2025
6 checks passed
@AltGr AltGr deleted the comptims branch December 18, 2025 16:10
@github-project-automation github-project-automation bot moved this from In Progress to Done in Catala - language & tooling Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants