SciML / SymbolicIndexingInterface.jl

A general interface for symbolic indexing of SciML objects used in conjunction with Domain-Specific Languages
https://docs.sciml.ai/SymbolicIndexingInterface/stable/
MIT License
14 stars 6 forks source link

Possibility to store symbolic indexing interface functions in targeted structures? #60

Closed TorkelE closed 5 months ago

TorkelE commented 5 months ago

If you want to access say variables from a ODE solution, you can either:

With the first being more performant if you want to make the access a very large number of times. It depends on how much space it take, but would it make sense to store getu(sol, X) in sol the first time sol[X] is called? The subsequent call sol[X] would have the same performance boost? sol could have a field which is empty to store these structures until they are required. Not sure how much space these getu functions take up, but figured it might be something to at least consider.

AayushSabharwal commented 5 months ago

We can't really cache the functions since doing so is type-unstable. Whenever a function is retrieved from the cache, it is inferred as Any (or at best Function) and calling it is slow. In general, if users cache the getu functions they need in an appropriately typed data structure, it will be significantly faster.

TorkelE commented 5 months ago

Got it. Don't really understand, but if it's been considered then all good.