Problem/Motivation

As a follow-up #3562989: Implements RevisionLogInterface for Instance entity. We are calculating the hash everytime we need (for display in LogsPanel or to check data changes):

class Instance extends ContentEntityBase implements InstanceInterface {

  public function getPublishedHash(): ?int {
    $published_data = $this->getBuildablePlugin()->getSources();

    return $published_data ? self::getUniqId($published_data) : NULL;
}

The logic is simple but it seems costly.

Proposed resolution

Because data is more often retrieved than saved, can we calculate the hash when we save the data instead ?

It will increase logic complexity (we need to save in both the live instance and in the permanent "published" storage) but it may increase performance.

How can we evaluate this performance gain, in order to decide if it is worth the hassle?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Status: Active » Needs work

Some pipeline fails, but there are OK on my local environment. Weird.

pdureau’s picture

Assigned: pdureau » Unassigned
Status: Needs work » Postponed

Some pipeline fails, but there are OK on my local environment. Weird.

It may be because my local environment follows ui_patterns:2.0.x when CI needs ui_patterns:2.0.15 because if i switch locally to ui_patterns:2.0.15, I have the same fails.

Let's wait ui_patterns:2.0.16