Skip to content

Commit af400eb

Browse files
committed
correct release asset charts
1 parent 906a2e9 commit af400eb

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

data-lib/src/release/data_array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ impl ReleaseDataArray {
209209

210210
self.raw_data
211211
.iter()
212-
.flat_map(|release| release.assets.iter())
213-
.group_by(|asset| get_asset_cpu_instruction_set(&asset.name))
212+
.flat_map(|release| release.assets.iter().map(move |asset| (release, asset)))
213+
.group_by(|(release, asset)| get_asset_cpu_instruction_set(release, asset))
214214
.map(|(instruction_set, assets)| {
215215
let downloads: u64 = assets
216216
.iter()
217-
.map(|asset| *asset.downloads.values().max().unwrap_or(&0) as u64)
217+
.map(|(_, asset)| *asset.downloads.values().max().unwrap_or(&0) as u64)
218218
.sum();
219219

220220
StackedNamedDataPoint {

data-lib/src/release/mod.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,18 @@ pub fn get_asset_release_file_type(file_name: &str) -> Option<String> {
113113
}
114114
}
115115

116-
pub fn get_asset_cpu_instruction_set(file_name: &str) -> Option<&'static str> {
117-
if file_name.ends_with(".dmg") {
118-
Some("both (.dmg)")
119-
} else if file_name.contains("arm64") {
120-
Some("arm64")
116+
pub fn get_asset_cpu_instruction_set(
117+
release_info: &GithubReleaseInfo,
118+
asset: &GithubAssetInfo,
119+
) -> Option<&'static str> {
120+
let is_dmg = asset.name.ends_with(".dmg");
121+
let is_combined_exe =
122+
asset.name.ends_with(".exe") && release_info.version >= Version::new(1, 6, 0, None);
123+
124+
if is_dmg || is_combined_exe {
125+
Some("Both")
126+
} else if asset.name.contains("arm64") {
127+
Some("ARM")
121128
} else {
122129
Some("x86")
123130
}

website/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Obsidian Stats Website
22

3-
See readme in the repo root.
3+
See readme in the repo root.

website/src/pages/releasestats/assets.astro

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ const assetInstructionSet = dataArray.get_asset_instruction_set_percentages();
2929

3030
<p>
3131
The next graph shows the evolution of asset sizes over time. The data is split by asset type. Note that gaps may appear, as not every asset type is included
32-
in every release.
32+
in every release. The macOS <code>.dmg</code> assets are about twice as large as others, as they include both an x86 and an ARM version of the app. The <code
33+
>.exe</code
34+
> assets after version <code>1.6.0</code> are even larger, as they contain an x86, a 32 bit x86, and an ARM version of the app in a singe installer.
3335
</p>
3436

3537
<p><AssetSizeChart dataPoints={assetSize} client:only="svelte" /></p>
3638

3739
<p>
3840
This graph shows the split between downloads of assets for different instruction sets. The instruction set is the type of CPU architecture that the asset is
39-
built for, such as x86 or ARM. From this we can see that downloads for ARM make up only {
40-
assetInstructionSet.find(x => x.layer === 'arm64')?.value?.toFixed(1)
41-
}% of the total downloads. The macOS <code>.dmg</code> assets make up the <code>both (.dmg)</code> category with {
42-
assetInstructionSet.find(x => x.layer === 'both (.dmg)')?.value?.toFixed(1)
43-
}%, as they can be used on both x86 and ARM Macs.
41+
built for, such as x86 or ARM. From this we can see that downloads for only-ARM assets make up only {
42+
assetInstructionSet.find(x => x.layer === 'ARM')?.value?.toFixed(1)
43+
}% of the total downloads. The Windows <code>.exe</code> assets for version <code>1.6.0</code> and later and the macOS <code>.dmg</code> assets are combined
44+
installers that include both x86 and ARM versions, and are thus labeled as "Both".
4445
</p>
4546

4647
<p><StackedXBarChart dataPoints={assetInstructionSet} percentages client:only="svelte" /></p>

0 commit comments

Comments
 (0)