Closed Syriiin closed 5 years ago
if you need to be that efficient, don't use autocalc mode at all. for now autocalc mode is meant to recalc on every single param change for maximum simplicity. which is handy for example if you want to have a ui where you change individual params or a quick way to test from a REPL
yea but all but currently exposed calculate functions hit free_owned_map()
and force a reparse dont they?
if you know there aren't map changes, you shouldnt need to reparse, right?
it only forces a re-parse if using autocalc mode. otherwise it will always use the params from the last parse https://github.com/Francesco149/oppai-ng/blob/master/oppai.c#L2356
remember that you will have to manually invalidate the params when you actually need to reparse
the test suite runner uses it exactly this way to avoid re-parsing (maps are sorted by id) https://github.com/Francesco149/oppai-ng/blob/master/test/test.c#L58
I seeeee, cool makes sense. thanks
From the python bindings, there is no
OPPAIAPI
exposed function to recalculate that doesn't callfree_owned_map()
, other than usingezpp_dup
/ezpp_data_dup
with autocalc mode.This works, but what if you want to make multiple parameter changes before recalculating, such as changing both mods and accuracy? As far as I can see, currently there is no way to do this without either a wasted map reparse (from calling
ezpp()
with the same map), atleast one wasted calculation run (from autocalc mode), or some weird abuse of autocalc mode by toggling off and on.I imagine this could be fixed by simply a exposing the
calc()
method via OPPAIAPI asezpp_calc()
(or something). Ideallyp_map
/p_map_mem
would also be exposed asezpp_parse
/ezpp_parse_data
(or something) so you wouldn't need to worry about using a different part of the API for recalculations, but that's not as major.