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

replace built_value and built_collection #857

Open
dave-doty opened this issue May 13, 2023 · 0 comments
Open

replace built_value and built_collection #857

dave-doty opened this issue May 13, 2023 · 0 comments
Labels
challenging indicates that fixing this issue is expected to be more challenging than average enhancement New feature or request

Comments

@dave-doty
Copy link
Member

dave-doty commented May 13, 2023

The built_value and built_collection packages are used in scadnano for immutable objects. However, because it uses code generation at compile time, due to the huge number of built_value objects (both in the state and actions subfolders) it is now very slow to compile the project, usually taking at least 45 seconds, and sometimes up to 2 or 3 minutes.

An alternative would be to avoid these packages and do immutability "manually". We could replace the built_collection package with fast_immutable_collections. I don't know if it's any faster, hopefully it is, and also could be easier to use. Definitely using "plain Dart" immutable objects would be easier to use, although it may be more cumbersome to create them since we would no longer have automatically provided methods such as JSON serialization and equality testing. However, this may be simpler to provide with a mixin that we write ourselves.

There is an alternative to built_value, called freezed. However, it also uses code generation so may be just as slow as built_value.

@dave-doty dave-doty added enhancement New feature or request challenging indicates that fixing this issue is expected to be more challenging than average labels May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenging indicates that fixing this issue is expected to be more challenging than average enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant