Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Fast payloads use 4 MB segments, so the segment test no longer writes and packs 96 MB

KnifeLemon375776053638
diff --git a/src/Filee.Setup/Payload/SetupPayload.cs b/src/Filee.Setup/Payload/SetupPayload.cs
index ecf62728..c1678fe3 100644
--- a/src/Filee.Setup/Payload/SetupPayload.cs
+++ b/src/Filee.Setup/Payload/SetupPayload.cs
@@ -263,6 +263,9 @@ public sealed class SetupPayload : IDisposable
/// <summary>Raw size from which files start a new segment (each segment is compressed on its own core).</summary>
public const long SegmentSize = 96L << 20;
+ /// <summary>Segment size of a fast (checks only) payload: small, so tests reach several segments cheaply.</summary>
+ public const long FastSegmentSize = 4L << 20;
+
/// <summary>
/// LZMA dictionary: matches reach 64 MB back, past the largest file. Unpacking needs this much memory per
/// segment (at most four at once).
@@ -292,12 +295,13 @@ public sealed class SetupPayload : IDisposable
PayloadManifest.CheckPath(relative);
// Consecutive files up to SegmentSize per segment.
+ var segmentSize = fast ? FastSegmentSize : SegmentSize;
var groups = new List<List<string>>();
- long groupSize = SegmentSize;
+ long groupSize = segmentSize;
foreach (var relative in paths)
{
var size = new FileInfo(Path.Combine(appFolder, relative)).Length;
- if (groupSize >= SegmentSize)
+ if (groupSize >= segmentSize)
{
groups.Add([]);
groupSize = 0;
diff --git a/tests/Filee.Setup.Tests/PayloadTests.cs b/tests/Filee.Setup.Tests/PayloadTests.cs
index 8a11649a..c8335737 100644
--- a/tests/Filee.Setup.Tests/PayloadTests.cs
+++ b/tests/Filee.Setup.Tests/PayloadTests.cs
@@ -74,7 +74,7 @@ public class PayloadTests
{
using var bench = new SetupBench(app: (temp, _) =>
{
- temp.Write(@"app\a.bin", new string('a', (int)(SetupPayload.SegmentSize + 1000)));
+ temp.Write(@"app\a.bin", new string('a', (int)(SetupPayload.FastSegmentSize + 1000)));
temp.Write(@"app\b.bin", new string('b', 2_000_000));
});
using var payload = SetupPayload.Open(bench.SetupExe)!;