Skip to content

Commit a8aa1f6

Browse files
committed
Turn off caching for the full flavor by default
Some testing reveals that the 64-bit and the 32-bit `full` SDK weigh in with ~1,300MB and ~915MB at time of writing, respectively. Packing and saving these to the cache takes a long time: ~5m20s and ~2m45s. Given that the non-cached download takes ~8m20s and ~6m, respectively, and restoring the artifacts from cache takes ~8m15s and ~5m (which is not a lot faster, not by a long stretch), it is neither worth the time nor the disk space to cache the `full` SDKs. Let's introduce a new default value for the input parameter `cache`, `auto`, that turns on caching except for the `full` flavor. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent aac36eb commit a8aa1f6

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ By default, this Action prints a line whenever 250 items were extracted (this do
7070

7171
To accelerate this Action, artifacts are cached once downloaded. This can be turned off by setting the input parameter `cache` to `false`.
7272

73+
In practice, caching the `full` artifacts does not provide much of a speed-up. Instead, it slows it down by adding several minutes during with the artifact is cached. Therefore, caching is disabled for the `full` artifacts by default, corresponding to `cache: auto`.
74+
7375
## Developing _this_ Action
7476

7577
> First, you'll need to have a reasonably modern version of `node` handy, such as Node 12.

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
cache:
2222
required: false
2323
description: 'Use @actions/cache to accelerate this Action'
24-
default: 'true'
24+
default: 'auto'
2525
runs:
2626
using: 'node12'
2727
main: 'dist/index.js'

main.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ async function run(): Promise<void> {
1717

1818
const {artifactName, download, id} = await get(flavor, architecture)
1919
const outputDirectory = core.getInput('path') || `C:/${artifactName}`
20-
let useCache = core.getInput('cache') === 'true'
20+
let useCache: boolean
21+
switch (core.getInput('cache')) {
22+
case 'true':
23+
useCache = true
24+
break
25+
case 'auto':
26+
useCache = flavor !== 'full'
27+
break
28+
default:
29+
useCache = false
30+
}
2131

2232
try {
2333
if (useCache && (await restoreCache([outputDirectory], id))) {

0 commit comments

Comments
 (0)