Files
SWCompression/Sources/swcomp/Benchmarks/SaveFile.swift
T
Timofey Solomko f47d541882 [swcomp] Introduce a new, more flexible version of the save file format
It features a separate struct for results metadata and also allows multi-way comparisons with previously saved results.
2022-10-11 11:21:36 +03:00

28 lines
565 B
Swift

// Copyright (c) 2022 Timofey Solomko
// Licensed under MIT License
//
// See LICENSE for license information
import Foundation
struct SaveFile: Codable {
struct Run: Codable {
var metadataUUID: UUID
var results: [BenchmarkResult]
}
var metadatas: [UUID: BenchmarkMetadata]
var runs: [Run]
static func load(from path: String) throws -> SaveFile {
let decoder = JSONDecoder()
let data = try Data(contentsOf: URL(fileURLWithPath: path))
return try decoder.decode(SaveFile.self, from: data)
}
}