Skip to content

Optimizations and clean up #24

Description

@widberg
  • Avoid recompressing resource bodies when writing to the pool

  • Parallelize reading/writing the actual BigFile file by only scanning for resource offsets the first time through and not actually reading/decompressing anything.

  • Reduce file reads and memory allocations. Could use memmap2 crate and store slices into the file, only allocating when a buffer is needed for decompression and even then use an arena owned by the bf and only have slices into that. First it would probably be a good idea to use zerocopy and have the parsed classes borrow the decompressed resources, make sure it works with either endianness. https://nnethercote.github.io/perf-book/.

  • Store binary versions of resources in a hidden folder and use those to avoid redoing work when importing if none of the exported files were modified.

  • Use rayon for sorting and filtering in the GUI, and potentially other places

  • Use base64 for large byte arrays when serializing (https://docs.rs/serde_with/latest/serde_with/base64/index.html ?) only when is_human_readable.

  • Replace the global static NAMES with serde_context. Should pass a context around during serde and formatting operations. For formatting names, consider doing something like this where display takes in the names context. Also, just reconsider how names work in general after all of that is implemented. They feel very hacky. Consider splitting class names into their own type and map.

  • Have a prepass on the manifest that only reads the version and makes a new name context with that. Then you can use that to parse the manifest for real. Also, don't allow explicitly setting the name type to switch between the HashMaps. Only have one HashMap for the active name type and explicitly convert between types, rehashing everything if needed.

  • Experiment with different malloc implementations like mimalloc and jemalloc.

  • Reduce compile times

  • Use Vec/HashMap::with_capacity/reserve more often, specifically while loading BigFiles.

  • Use binrw with to avoid having helper types like DynArray be the actual type of a struct member.

  • Experiment with larger buffer sizes for the buffered readers/writers.

  • Experiment with alternative HashMap implementations.

Metadata

Metadata

Assignees

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions