Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise external secondary instance memory use #6454

Open
seadowg opened this issue Oct 14, 2024 · 0 comments
Open

Optimise external secondary instance memory use #6454

seadowg opened this issue Oct 14, 2024 · 0 comments
Milestone

Comments

@seadowg
Copy link
Member

seadowg commented Oct 14, 2024

As we did for entities with #5623, we should optimise all external CSV secondary instances (that aren't entity lists) so that they do not need to be loaded into memory for simple eq filters (<child> = '<value>').

Unlike with entities, we can get away with creating the optimised representation (probably a SQLite DB) on form load as long as this only has to happen once for each form version.

The result of this should be that, for an expression like age = 25:

  • The full secondary instance does not need to be in memory to evaluate the expression (other than temporarily on first form version load)
  • The expression can be evaluated in a reasonable time (under 5s) on mainstream devices for datasets as large as 100k items (like with entities).

Questions

Notes

Implementing this should be fairly similar to entities, with the exception of creating the optimised representation on load rather than on form download. This probably means that we want to create a custom FileInstanceParser that Collect can configure JavaRosa to use that creates this representation if it doesn't already exist when the instance is parsed and then handles returning the instance as a TreeElement. Like with entities, this will have to handle "partial" and "full" parses to allow the low memory footprint for large datasets. There will also need to be some kind of FilterStrategy that (again like entities) handles the optimised expressions and deals with replacing partial elements in the instance.

It might be possible to share the entities FilterStrategy (and potentially even the FileInstanceParser/Instance Provider with some rework) by generalizing LocalEntitiesInstanceAdapter.

Another thing to point out is that we'll most likely want to create the optimised representation at download time in the future, so the implementation should account for making that easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ready
Development

No branches or pull requests

1 participant