Skip to content

Conversation

@ProgMiner
Copy link
Contributor

@ProgMiner ProgMiner commented Jun 23, 2025

Since variables allocated linearly of allocation time, this optimization must increase Var.subst optimization hit rate and shorten Subst.walk recursion paths

@ProgMiner ProgMiner requested a review from Kakadu as a code owner June 23, 2025 20:05
@Kakadu
Copy link
Collaborator

Kakadu commented Jun 24, 2025

Since variables allocated linearly of allocation time, this optimization must increase Var.subst optimization hit rate

I don't really understand how it is related. Var.subst fires depending on the place of fresh logic variable, not on it's value.

11: { 0: [| 11 =/= _.10 |] }
11: { 0: [| 11 =/= boxed 0 <_.12, _.13> |] }
11: { 0: [| 11 =/= _.10 |] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it really correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added explanation in the commit message

@ProgMiner
Copy link
Contributor Author

Since variables allocated linearly of allocation time, this optimization must increase Var.subst optimization hit rate

I don't really understand how it is related. Var.subst fires depending on the place of fresh logic variable, not on it's value.

Since we allocate variable numbers linearly, we may assume that variables with greater number was allocated after variables with less number. So, if we have two variables x and y and x.number < y.number, we may assume that y was allocated nearly to the current execution point in source program. So, if x was allocated in the local scope, y must be allocated in the local scope too since it was allocated closer to the current execution point than x. So y will be in local scope with more probability.

Since variables allocated linearly of allocation time, this optimization
must increase [Var.subst] optimization hit rate and shorten [Subst.walk]
recursion paths

In "regression_ppx/test015.t" we have change from term to variable
because of swapping sides of disequality in constraint store. As a
result, we doesn't simplify the constraint when variable "10" is
unified.

Signed-off-by: Eridan Domoratskiy <eridan200@mail.ru>
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.

2 participants