SFTtech/openage

Reduce converter memory usage with on-demand read

Open

#1 256 ouverte le 4 mai 2020

Voir sur GitHub
 (4 commentaires) (1 réaction) (0 assignés)Python (1 135 forks)batch import
area: assetsgood first issuelang: python

Métriques du dépôt

Stars
 (12 130 stars)
Métriques de merge PR
 (Merge moyen 9j 23h) (1 PR mergée en 30 j)

Description

Required skills: Python

Difficulty: Medium

The new converter (#1151) uses member objects to operate on data from the .dat files. While these provide the necessary functions for conversion, they are also significantly larger than the original dat file entries (20x - 400x the size). This results in a comparatively high memory usage, especially for DE2 which uses ~1.1 GB of memory for all dat file entries. Note that the converter does not create objects for all entries by default, but the size difference compared to the source is still significant.

A solution to this problem could be that we read certain structures into member objects on-demand during conversion, instead of all converting them during the initial read.

This would require:

  • A special ValueMember class that references an offset in the .dat file and a GenieStructure reference for the dataformat.
  • Manual loading and unloading of the structure from file
  • Dynamic loading and unloading of the structure from file
  • Identifying places in the converter where manual loading makes sense

Guide contributeur