Skip to content

Add a common Simplificator in the Traverser #1261

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
Nov 2, 2022

Conversation

sergeypospelov
Copy link
Member

@sergeypospelov sergeypospelov commented Oct 31, 2022

Description

Refactor:

  • Removed runBlockingWithCancellationPredicate in our tests pipeline
  • Moved ExecutionState to org.utbot.engine.state package. Moved out succeeding operations for ExecutionState to ExecutionStateUpdates.kt
  • Some minor refactorings

Add:

  • A common Simplifer which holds a cache for a whole Traverser.
  • A MemoryUpdateSimplifier which simplifies MemoryUpdates.

Problems:

  • Also tried to add simplified local memory updates, but didn't succeed. SetsTest::testSetContainsInteger was continuously failing. Now they aren't being simplified explicitly, but simplified implicitly with Traverser::resolve(Value) function.

Type of Change

  • Refactoring (typos and non-functional changes)

How Has This Been Tested?

Automated Testing

Tests are passing.

Manual Scenario

I checked our engine on synthetic test with ~200 groups of array store and array select expressions (see code), and now it's 50 times faster.

public int longMethod(int x, int y) {
    int[] arr = new int[201];
    int cur = 1;

    arr[cur] = arr[cur - 1] + x - y;
    cur++;

    arr[cur] = arr[cur - 1] + x - y;
    cur++;

    // ^^^^
    // 200 times
   
    if (arr[cur - 1] == 400) {
        return 1;
    }
    return 2;
}

Checklist:

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • No new warnings
  • All tests pass locally with my changes

@sergeypospelov sergeypospelov marked this pull request as draft October 31, 2022 02:21
@sergeypospelov sergeypospelov changed the title Draft optimizations Optimizations in Engine Oct 31, 2022
@sergeypospelov sergeypospelov force-pushed the sergey/optimizations branch 5 times, most recently from 331f8e2 to 6a964f8 Compare November 2, 2022 03:11
@sergeypospelov sergeypospelov changed the title Optimizations in Engine Add a common Simplificator in the Traverser Nov 2, 2022
@sergeypospelov sergeypospelov marked this pull request as ready for review November 2, 2022 04:23
@sergeypospelov sergeypospelov enabled auto-merge (squash) November 2, 2022 08:02
@sergeypospelov sergeypospelov merged commit 1c5d1e5 into main Nov 2, 2022
@sergeypospelov sergeypospelov deleted the sergey/optimizations branch November 2, 2022 09:31
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