Some tips on data needed…
I have game data which is loaded from a file and after that immutable (except when freeing the used memory in some of the structs, when the program closes).
In my “local debug” environment I create / import the below Metadata from a bunch of files on my local disk. I have some homemade on-disk-structure which works ok.
(using a save_to_file(metadata) and load_from_file(): Metadata function).
Now I was wondering if it would be worth the effort to change this:
pub const Metadata = struct {
images: std.ArrayList(Image),
styles: std.ArrayList(Style),
lemmings: std.ArrayList(Lemming),
// etc.
};
into this:
pub const Metadata = struct {
images: []Image,
// etc.
}
or even this:
pub const Metadata = struct {
images: []const Image,
// etc.
}
And when creating the file in my local environment use ArrayList just when building the stuff.
When ready convert all Lists to slices with ArrayList.toOwnedSlice().
Or just keep the lists.
Any tips? Ideas?