-
Notifications
You must be signed in to change notification settings - Fork 153
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
Measure local build cache size growth #477
Conversation
1ac94a1
to
ab9f7c6
Compare
ab9f7c6
to
0381cef
Compare
7640820
to
e16ca95
Compare
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.2.0/math.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.7.14/vue.min.js"></script> | ||
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js'></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/11.5.1/math.min.js"></script> |
Check warning
Code scanning / CodeQL
Inclusion of functionality from an untrusted source
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.0.0-beta/chart.min.js'></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.2.0/math.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.7.14/vue.min.js"></script> | ||
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js'></script> |
Check warning
Code scanning / CodeQL
Inclusion of functionality from an untrusted source
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.12/vue.min.js"></script> | ||
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.0.0-beta/chart.min.js'></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.2.0/math.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.7.14/vue.min.js"></script> |
Check warning
Code scanning / CodeQL
Inclusion of functionality from an untrusted source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some comments and tests need attention I see
? Stream.empty() | ||
: Stream.of(cacheDirs); | ||
} | ||
cacheDirectories.forEach(cacheDirectory -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 Maybe just with streams:
cacheDirectories
.map(File::listFiles)
.filter(Objects::nonNull)
.flatMap(Stream::of)
.forEach(file -> {
fileCount.incrementAndGet();
size.addAndGet(file.length());
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll bite :)
import com.google.gson.JsonPrimitive; | ||
import com.google.gson.JsonSerializationContext; | ||
import com.google.gson.JsonSerializer; | ||
import com.google.gson.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧐 Star import that needs attention?
if (cacheFiles == null) { | ||
System.out.println("> Cannot list cache directory " + cacheDir); | ||
} else { | ||
long size = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 Maybe this could be:
long size = Stream.of(cacheFiles).mapToLong(File::length).sum()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I noticed build cache size is always reported zero, is that just for me?
* Running measured build #25
Execution time 1112 ms
> Build cache size: 0 bytes in 0 file(s) (build-cache-1)
> Build cache size: 0 bytes in 0 file(s) (build-cache-2)
Are you running a build without the build cache being enabled? I get it reported fine:
|
I added a test for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
@Override | ||
public double extractValue(T result) { | ||
return extractTotalDurationFrom(result).toNanos() / 1_000_000d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧐 Does Duration has .toMillis(), to just do extractTotalDurationFrom(result).toMillis()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to capture fractional milliseconds.
Otherwise format can contain a comma instead of a dot on some systems.
7f742e1
to
735db1b
Compare
Well spotted fixes, thanks! |
When tests use the local cache, its size can grow. We want to capture that information in the benchmarks.