Closed kwrooijen closed 1 year ago
I don't think there's much risk in changing these to defs since they are only set during model registration. Which generally only happens once at system startup.
I think it is part of normal workflow to re- mode/register!
in the repl when working out the kinks in a model. Will that still be supported?
I don't see why not. The point of atoms is to handle parallelism and make sure data stays in sync. I can't imagine having two threads calling model/register!
at the same time. Other than that the current behavior will not change.
Currently the model namespace keeps track of registered models and creates maps for "quick" mapping (e.g. mapping a model field to table column). This is mainly for performance benefits.
https://github.com/kwrooijen/gungnir/blob/54fa3b8083c21d52e3c2990ef04cf4a63a1ad8b9/src/cljc/gungnir/model.cljc#L12-L17
These maps are stored in atoms. However it might be nice to actually store then in
^:dynamic
defs and change them withalter-var!
. This would remove the deref overhead and possibly improve performance slightly. I don't think there's much risk in changing these to defs since they are only set during model registration. Which generally only happens once at system startup.