Comments (12)
Please review the following and let me know if you are on the same page.
TL;DR
There is no reason to cache the binary cache directory content on the GitHub cache service, as it will just increase the restore from cache scenario. Continuing caching the $VCPKG_ROOT
directory is the most performant solution.
Details
Please remember that run-vcpkg
puts into the GitHub cache service basically all of $VCPKG_ROOT
(excluding some directories to dramatically reduce the required space). So when the action installs sqlite3
package and the package has been restored from the GitHub cache, it takes <0.1 second.
OTOH, if run-vcpkg
is changed to do as requested here, installing sqlite3
(i.e. vcpkg install sqlite3
) with the $VCPKG_ROOT/installed
directory empty, it would take >3 seconds. The times looks like spent mostly in detecting the "compiler hash for triplet..." (longer on Windows than on Linux, but in both cases it's >1 second), and expanding the archive and writing the new files onto $VCPKG_ROOT/installed
directory.
from run-vcpkg.
In the cache hit scenario, that's the correct TL;DR -- as long as every package is in the installed\ folder, we won't consult the archives. The only way a package would be missing from the installed folder is if the cache didn't hit, in which case the archives would also be missing. There is potentially some improvement available via fallback keys on the archives directory, however I think this is relatively low value.
Instead, we recommend using GitHub Packages[1] to store the binaries via our NuGet backend. This will reuse packages as much as possible and complement the Cache Task to maximize performance and minimize rebuilds.
[1] https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md#github-packages
from run-vcpkg.
@Milerius the run-vcpkg
action has been designed for vcpkg "classic", where all the installed ports are installed in $VCPKG_ROOT/installed
directory.
The binary caching is a preview feature this action is not currently supporting. Before supporting "modern/future" vcpkg, I'd need to understand in detail how this newly created features (e.g., binary caching and manifest) are working and how to support them.
I'd be glad if the exact and complete specs would be provided in here before I can do it.
If I do it first, I'll share them in here before rushing implementing those, as feedback is always useful.
from run-vcpkg.
@lukka binary caching is no longer unstable, and it's the recommended way to do caching nowadays; see the docs here. The readthedocs are usually out of date, since someone has to manually run the script to update them.
from run-vcpkg.
@strega-nil: good to know! I need time to write a design around it, i.e. how would the flowchart change.
TL;DR: I think it would be helpful to have in vcpkg
a command that prints out the result of the vcpkg's cache directory computation logic (i.e. it prints the directory).
Details:
Is it needed to implement an high fidelity replica of the logic described here?
run-vcpkg
needs to know whether binary caching is being used or not; and it needs to reliably know what is the directory where the cache needs to be restored into (before running vcpkg), and saved later from. I.e. whatever vcpkg
thinks it is the right directory for caching, that is the one run-vcpkg
must accurately know as well.
from run-vcpkg.
@ras0219 should be able to tell you more :)
from run-vcpkg.
based on the conclusions, no changes are needed to this action regarding the cached directories.
from run-vcpkg.
There is no reason to cache the binary cache directory content on the GitHub cache service, as it will just increase the restore from cache scenario. Continuing caching the $VCPKG_ROOT directory is the most performant solution.
Caching VCPKG_ROOT is hardly helpful, at least for manifest mode. All it helps with is avoiding needing to bootstrap the vcpkg executable. Caching VCPKG_ROOT/packages, VCPKG_ROOT/buildtrees, VCPKG_ROOT/downloads does not help; vcpkg still does a full rebuild every time (in manifest mode at least).
So when the action installs sqlite3 package and the package has been restored from the GitHub cache, it takes <0.1 second.
OTOH, if run-vcpkg is changed to do as requested here, installing sqlite3 (i.e. vcpkg install sqlite3) with the $VCPKG_ROOT/installed directory empty, it would take >3 seconds. The times looks like spent mostly in detecting the "compiler hash for triplet..." (longer on Windows than on Linux, but in both cases it's >1 second), and expanding the archive and writing the new files onto $VCPKG_ROOT/installed directory.
For these use cases caching is hardly relevant anyway. For complex applications with large dependencies like FFmpeg (30 minute build), wxWidgets (10 minute build), or Qt5 (>2 hour build!), the cost of computing the hash for vcpkg's package cache key is trivial compared to the build time. Running vcpkg install
for this dependency list for Tenacity:
"dependencies": [
"libflac",
"lilv",
"libmad",
"libogg",
"libsndfile",
"soxr",
"libvorbis",
"soundtouch",
"libsbsms",
"portaudio",
"portmidi",
"portsmf",
"mp3lame",
"libogg",
"libvorbis",
"zlib",
"expat",
"sqlite3",
"ffmpeg",
"libpng",
"tiff",
"zlib"
]
takes 9 seconds, which is very fast from my perspective.
There is potentially some improvement available via fallback keys on the archives directory, however I think this is relatively low value.
The benefits of fallback restore keys are huge if an application has even one dependency that takes a long time to build.
I have fixed these issues in #94.
from run-vcpkg.
@Be-ing Thanks for adding this comment! I'd like to put your comments on the right context first, as I think we are almost on the same page, only some clarifications are still needed.
Caching VCPKG_ROOT is hardly helpful, at least for manifest mode. All it helps with is avoiding needing to bootstrap the vcpkg executable. Caching VCPKG_ROOT/packages, VCPKG_ROOT/buildtrees, VCPKG_ROOT/downloads does not help; vcpkg still does a full rebuild every time (in manifest mode at least).
Caching $VCPKG_ROOT
means to save its content except for what is not useful. That is, all but packages
, buildtrees
and downloads
. And please note that when the vcpkg.json
manifest mode is used (which is the mode the action and the samples are tailored with) a full rebuild does not take place.
I'd be curious to see what is the run-vcpkg
run time in cache-hit scenario on the tenacity project (which is the "restore VCPKG_ROOT scenario except what is not needed"), compared to the time spent to leverage vcpkg's binary caching
created archives (and restoring those from cache).
Also, I really appreciated your contribution on #94, which is something I was preparing already but I did not publish yet. So you beat me to it!
from run-vcpkg.
I'd be curious to see what is the run-vcpkg run time in cache-hit scenario on the tenacity project (which is the "restore VCPKG_ROOT scenario except what is not needed"), compared to the time spent to leverage vcpkg's binary caching created archives (and restoring those from cache).
Without #94 every package is fully rebuilt for any cache miss. The action is hardly useful for my purposes like that.
from run-vcpkg.
I just realized I got confused by the incorrect information in the README:
# Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed' directory.
additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed
Manifest mode installs to vcpkg_installed
in the root of the repository being built (the same directory as the vcpkg.json file). This directory is outside the CMake build directory.
from run-vcpkg.
Caching the vcpkg_installed
directory in manifest mode is indeed slightly faster that caching the user local binary cache.
from run-vcpkg.
Related Issues (20)
- run-vcpkg's vcpkg.exe no longer being picked up by MSBuild/Visual Studio even with `vcpkg integrate install` HOT 5
- Saving cache is skipped HOT 16
- Defer completely to vcpkg to determine whether a cache is outdated HOT 9
- Ensure the cache content is minimum required
- Need PATH to be set to included libraries created by vcpkg HOT 5
- Help wanted : vcpkg can't unpack oneTBB (Disk Full) HOT 2
- Issues when trying to use the action HOT 11
- VCPKG failing to build library HOT 17
- macos build fail after macos GH hosted runner updates on 16 Feb 2023 - Root cause: missing pkg-config HOT 1
- Saving duplicate cache HOT 2
- Use a separate cache entry for OS independent files HOT 10
- run-vcpkg could turn on/off the cache of vcpkg according to platform (e.g. doNotCache:false on ARM)
- v11 has been published onto the v10 branch HOT 2
- run-vcpkg@v11 requires manually setting environment variables for caching to work HOT 6
- run-vcpkg@v11 does not support prepended/appendedCacheKey HOT 2
- run-vcpkg failing with "dyld: Symbol not found: __ZNKSt3_V214error_category10_M_messageB5cxx11Ei" HOT 4
- One package not cached HOT 6
- About Static Linking HOT 4
- some errors when install package HOT 1
- Running the action in a container fails. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from run-vcpkg.