-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from Bedrock-OSS/exp-size_time_check
Implement experiments flag and size_time_check experiment
- Loading branch information
Showing
56 changed files
with
574 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: Experiments | ||
--- | ||
|
||
# Experiments | ||
|
||
Experiments are new experimental features of Regolith to be released in the future versions, once proven to be stable and useful. The experiments can be enabled with the `--experiments` flag. | ||
|
||
## Currently Available Experiments | ||
|
||
### `size_time_check` | ||
|
||
The `size_time_check` is an experiment that aims to speed up `regolith run` and `regolith watch` commands. It achieves this by checking the size and modification time of the files before moving them between working and output directories. If the source file is the same size and has the same modification time as the destination file, the target file will remain untouched (Regolith assumes that the files are the same). | ||
|
||
The `size_time_check` should greatly speed up the exports of large projects. | ||
|
||
The downside of this approach is that on the first run, the export will be slower, but on subsequent runs, the export will be much faster. This means that the `size_time_check` is not recommended for CI where Regolith is run only once. | ||
|
||
Usage: | ||
``` | ||
regolith run --experiments size_time_check | ||
regolith watch --experiments size_time_check | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package regolith | ||
|
||
type Experiment int | ||
|
||
const ( | ||
// SizeTimeCheck is an experiment that checks the size and modification time when exporting | ||
SizeTimeCheck Experiment = iota | ||
) | ||
|
||
// The descriptions shouldn't be too wide, the text with their description is | ||
// indented a lot. | ||
const sizeTimeCheckDesc = ` | ||
Activates optimization for file exporting by checking the size and | ||
modification time of files before exporting, and only exporting if | ||
the file has changed. This experiment applies to 'run' and 'watch' | ||
commands. | ||
` | ||
|
||
type ExperimentInfo struct { | ||
Name string | ||
Description string | ||
} | ||
|
||
var AvailableExperiments = map[Experiment]ExperimentInfo{ | ||
SizeTimeCheck: {"size_time_check", sizeTimeCheckDesc}, | ||
} | ||
|
||
var EnabledExperiments []string | ||
|
||
func IsExperimentEnabled(exp Experiment) bool { | ||
if EnabledExperiments == nil { | ||
return false | ||
} | ||
for _, e := range EnabledExperiments { | ||
if e == AvailableExperiments[exp].Name { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.