Skip to content
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

MergeDiagnosticJson should not be build cacheable #1436

Merged
merged 4 commits into from
Feb 13, 2023

Conversation

CRogers
Copy link
Contributor

@CRogers CRogers commented Feb 13, 2023

Before this PR

mergeDiagnosticJson is cacheable, meaning that Gradle will spend 5 seconds looking for a cache entry to save doing ~10-20 milliseconds of actual work (given the jars it's scanning through is the runtime classpath, which is always needed and already cached). This is quite a common sight:

Screenshot 2023-02-13 at 17 50 52

After this PR

==COMMIT_MSG==
mergeDiagnosticJson is no longer build cacheable, as it spends 100x more time accessing the cache than just running the task
==COMMIT_MSG==

Possible downsides?

@CRogers CRogers requested a review from felixdesouza February 13, 2023 17:59
@changelog-app
Copy link

changelog-app bot commented Feb 13, 2023

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

mergeDiagnosticJson is no longer build cacheable, as it spends 100x more time accessing the cache than just running the task

Check the box to generate changelog(s)

  • Generate changelog entry

@@ -16,7 +16,4 @@

package com.palantir.gradle.dist.service;

import org.gradle.api.tasks.CacheableTask;

@CacheableTask
public abstract class MergeDiagnosticsJsonTask extends MergeDiagnosticsJsonTaskImpl {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth a comment so we don't attempt to re-"optimize" this in the future!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, I think in that case we would end up putting that comment on every single simple task we write...

Copy link
Contributor

Choose a reason for hiding this comment

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

you can go even better: @DisableCachingByDefault(because = "reasons"), you see it on the Copy task.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it would be entirely unreasonable to explicitly declare whether each task is cacheable or not, but I defer to your judgement.

…alantir/sls-packaging into callumr/merge-diagnostic-json-no-cache
@bulldozer-bot bulldozer-bot bot merged commit b2531df into develop Feb 13, 2023
@bulldozer-bot bulldozer-bot bot deleted the callumr/merge-diagnostic-json-no-cache branch February 13, 2023 18:54
@svc-autorelease
Copy link
Collaborator

Released 7.29.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants