Problem/Motivation

Caching for cspell uses content caching strategy right now. This is good, but means hashing all files. We could investigate using the git-restore-mtime package. This will set mtime to the git history and could mean we can use the metadata cachings strategy. This *might* improve the runtimes even more.

https://stackoverflow.com/questions/2458042/restore-a-files-modification...

Quick testrun of impact of running git restore-mtime:

[32;1m$ git restore-mtime[0;m
18,163 files to be processed in work dir
Statistics:
         0.22 seconds
       18,421 log lines processed
           50 commits evaluated
        4,057 directories updated
       18,163 files updated

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3464413

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

bbrala created an issue. See original summary.

catch’s picture

I think to do this we might want to install it on the docker images themselves to save the extra apt install step in each job.

eslint and stylelint have the same two cache strategy options so this would benefit all three if it's an improvement.

wim leers’s picture

Fascinating! 🤓

I have actually always wondered why this wasn't git's default behavior. I've found it confusing in the past. Thanks for teaching me, @bbrala 😄

bbrala’s picture

Issue tags: +Test suite performance
bbrala’s picture

Since we now fixed the cache retrieval for all jobs we should try this. Cspell with cache is still 1.5 minutes.

bbrala’s picture

Todo to validate, seems pretty straightforward,

  1. Add package to warm cache and lint jobs
  2. Adjust warm cache job to always run
  3. have lint jobs depend on that job and get the cache artifacts, double check they use metadata instead of file contents, that is either commandline argument or config change.
  4. Validate runtime against HEAD (minus the (pseudocode) apt update && apt install--y git-mtime && git mtime)
  5. Decide if we want it
  6. If so, add package to images
  7. Adjust cache and lint jobs to run the mtime fix
bbrala’s picture

Not gonna work if we use sparse checkouts, that means the minimum time is the 50th commit time. There might be ways around a full clone being slow by caching a sparse cron or something. But that seems like it's overkill.

There actually still might be merit to do this since it seems we do generate the cache every commit (push), so the state of the repo is kinda the same as the cache when the MR would run (cached on -50 commits, clones in MR at -50 commits, then merging changing and running linters).

Ok, think it might still be worth it.

bbrala’s picture

Well, that didnt really have any results.

https://git.drupalcode.org/issue/drupal-3464413/-/pipelines/295506

vs

https://git.drupalcode.org/issue/drupal-3464413/-/pipelines/295507

All times are comparable for the lint runs. Nothing much to do there it seems. I changed to metadata and got all the things as artifacts, but it didnt really speed anything up. So unless i screwed up the changes, not worth it.

catch’s picture

I think it might be at least good to keep the time on everything? It's useful to see the timings as much as possible.

I hadn't realised we're only spending less than 10 seconds on each actual linting step, but yeah that means we probably need to look in the other 1m20s for savings

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.