File size distribution: Difference between revisions
Content added Content deleted
Line 453: | Line 453: | ||
) (0, 0) |
) (0, 0) |
||
groupsFromGroup :: [Integer] -> FrequencyGroup -> [FrequencyGroup] |
groupsFromGroup :: Int -> [Integer] -> FrequencyGroup -> [FrequencyGroup] |
||
groupsFromGroup fileSizes ((min, max), count) = frequencyGroups |
groupsFromGroup gsize fileSizes ((min, max), count) = frequencyGroups gsize range |
||
where |
where |
||
collectBetween min max = filter (\n -> n >= min && n <= max) |
collectBetween min max = filter (\n -> n >= min && n <= max) |
||
range = collectBetween min max fileSizes |
range = collectBetween min max fileSizes |
||
expandGroups :: [Integer] -> Integer -> [FrequencyGroup] -> [FrequencyGroup] |
expandGroups :: Int -> [Integer] -> Integer -> [FrequencyGroup] -> [FrequencyGroup] |
||
expandGroups fileSizes groupThreshold groups |
expandGroups gsize fileSizes groupThreshold groups |
||
| all ((<= groupThreshold) . snd) groups = groups |
| all ((<= groupThreshold) . snd) groups = groups |
||
| otherwise = expandGroups fileSizes groupThreshold $ expand groups |
| otherwise = expandGroups gsize fileSizes groupThreshold $ expand groups |
||
where |
where |
||
expand = ((\g@((min, max), count) -> |
expand = ((\g@((min, max), count) -> |
||
if count > groupThreshold then |
if count > groupThreshold then |
||
groupsFromGroup fileSizes g |
groupsFromGroup gsize fileSizes g |
||
else |
else |
||
[g] |
[g] |
||
Line 549: | Line 549: | ||
putStrLn "\nDistribution:" |
putStrLn "\nDistribution:" |
||
let results = filteredGroups groupSize items |
let results = filteredGroups groupSize items |
||
deepResults = expandedGroups (sizes items) (groupThreshold fileCount) results |
deepResults = expandedGroups groupSize (sizes items) (groupThreshold fileCount) results |
||
mapM_ (displayFrequency fileCount) deepResults |
mapM_ (displayFrequency fileCount) deepResults |
||
where |
where |
||
Line 555: | Line 555: | ||
filteredGroups n = filter ((>0) . snd) . frequencyGroups n . sizes |
filteredGroups n = filter ((>0) . snd) . frequencyGroups n . sizes |
||
groupThreshold = round . (*0.25) . realToFrac |
groupThreshold = round . (*0.25) . realToFrac |
||
expandedGroups sizes n = filter ((>0) . snd) . expandGroups sizes n</lang> |
expandedGroups gsize sizes n = filter ((>0) . snd) . expandGroups gsize sizes n</lang> |
||
{{out}} |
{{out}} |
||
<pre style="height: 50rem;">$ filedist |
<pre style="height: 50rem;">$ filedist |
||
Using 4 worker threads |
Using 4 worker threads |
||
Total files: |
Total files: 431803 |
||
Total folders: 65528 |
Total folders: 65528 |
||
Total size: 6GB |
Total size: 6GB |
||
Distribution: |
Distribution: |
||
0B <-> 75B = 39305 9.103%: ████████████████████████████████████ |
|||
0B <-> 83B = 43580 10.093%: ████████████████████████████████████████ |
|||
76B <-> 151B = 36175 8.378%: ██████████████████████████████████ |
|||
84B <-> 167B = 40942 9.482%: ██████████████████████████████████████ |
|||
152B <-> 227B = 27747 6.426%: ██████████████████████████ |
|||
168B <-> 251B = 24867 5.759%: ███████████████████████ |
|||
228B <-> 303B = 19148 4.434%: ██████████████████ |
|||
252B <-> 335B = 20019 4.636%: ███████████████████ |
|||
301B <-> 601B = 50919 11.792%: ███████████████████████████████████████████████ |
|||
336B <-> 419B = 15623 3.618%: ██████████████ |
|||
602B <-> 902B = 41885 9.700%: ███████████████████████████████████████ |
|||
420B <-> 503B = 13403 3.104%: ████████████ |
|||
903B <-> 1KB = 43986 10.187%: █████████████████████████████████████████ |
|||
504B <-> 587B = 12778 2.959%: ████████████ |
|||
1KB <-> 2KB = 61277 14.191%: █████████████████████████████████████████████████████████ |
|||
588B <-> 671B = 12125 2.808%: ███████████ |
|||
2KB <-> 4KB = 29473 6.826%: ███████████████████████████ |
|||
672B <-> 755B = 12736 2.950%: ████████████ |
|||
4KB <-> 5KB = 17620 4.081%: ████████████████ |
|||
756B <-> 839B = 9565 2.215%: █████████ |
|||
5KB <-> 9KB = 28951 6.705%: ███████████████████████████ |
|||
826B <-> 2KB = 83110 19.247%: █████████████████████████████████████████████████████████████████████████████ |
|||
9KB <-> 14KB = 10941 2.534%: ██████████ |
|||
2KB <-> 2KB = 34092 7.895%: ████████████████████████████████ |
|||
14KB <-> 19KB = 5139 1.190%: █████ |
|||
2KB <-> 3KB = 20814 4.820%: ███████████████████ |
|||
19KB <-> 37KB = 8589 1.989%: ████████ |
|||
3KB <-> 4KB = 15088 3.494%: ██████████████ |
|||
37KB <-> 56KB = 3100 0.718%: ███ |
|||
56KB <-> 75KB = 1807 0.418%: ██ |
|||
75KB <-> 150KB = 2547 0.590%: ██ |
|||
150KB <-> 225KB = 933 0.216%: █ |
|||
225KB <-> 300KB = 697 0.161%: █ |
|||
⚫ | |||
8KB <-> 16KB = 18833 4.362%: █████████████████ |
|||
601KB <-> 902KB = 305 0.071%: |
|||
902KB <-> 1MB = 122 0.028%: |
|||
1MB <-> 2MB = 210 0.049%: |
|||
2MB <-> 4MB = 110 0.025%: |
|||
4MB <-> 5MB = 51 0.012%: |
|||
5MB <-> 9MB = 52 0.012%: |
|||
9MB <-> 14MB = 19 0.004%: |
|||
14MB <-> 19MB = 8 0.002%: |
|||
20MB <-> 40MB = 17 0.004%: |
|||
40MB <-> 61MB = 5 0.001%: |
|||
61MB <-> 81MB = 3 0.001%: |
|||
⚫ | |||
403KB <-> 483KB = 176 0.041%: |
|||
483KB <-> 564KB = 100 0.023%: |
|||
564KB <-> 644KB = 77 0.018%: |
|||
644KB <-> 725KB = 101 0.023%: |
|||
725KB <-> 805KB = 77 0.018%: |
|||
815KB <-> 2MB = 282 0.065%: |
|||
2MB <-> 2MB = 123 0.028%: |
|||
2MB <-> 3MB = 74 0.017%: |
|||
3MB <-> 4MB = 59 0.014%: |
|||
4MB <-> 5MB = 26 0.006%: |
|||
5MB <-> 6MB = 17 0.004%: |
|||
6MB <-> 6MB = 20 0.005%: |
|||
6MB <-> 7MB = 7 0.002%: |
|||
7MB <-> 8MB = 6 0.001%: |
|||
8MB <-> 16MB = 23 0.005%: |
|||
16MB <-> 24MB = 10 0.002%: |
|||
24MB <-> 32MB = 9 0.002%: |
|||
32MB <-> 40MB = 4 0.001%: |
|||
40MB <-> 49MB = 5 0.001%: |
|||
73MB <-> 81MB = 3 0.001%: |
|||
98MB <-> 196MB = 8 0.002%: |
98MB <-> 196MB = 8 0.002%: |
||
294MB <-> 392MB = 1 0.000%: </pre> |
294MB <-> 392MB = 1 0.000%: </pre> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |