From 98373a809cd82f254dddc7fd1eff9a6ec52c91b1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Oct 2016 15:18:09 -0400 Subject: Defer graph compilation in atomic bundles This avoids situations like compiling a graph hundreds of times when it is loaded because it has hundreds of nodes and each event triggers a re-compile. This speeds things up dramatically, but exacerbates the theoretical problem of there not being enough time in a cycle to execute a bundle. As far as I can tell, the execute phase of events is very fast, so hundreds or thousands can easily run in a tiny fraction of the process cycle, but this still needs resolution to be truly hard real-time. What probably needs to happen is that all context and state used to process is moved to CompiledGraph and nodes do not access their own fields at all, but have some references into the CompiledGraph. This way, a compiled graph is separate from its "source code", and an old one could continue to be run while a new one is beng applied across several cycles. --- src/server/events/Mark.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/server/events/Mark.hpp') diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index a68e3b3b..f2c02b93 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -44,15 +44,20 @@ public: SampleCount timestamp, Type type); - bool pre_process(); + ~Mark(); + + bool pre_process(PreProcessContext& ctx); void execute(RunContext& context); void post_process(); Execution get_execution() const override; private: - Type _type; - int _depth; + typedef std::map CompiledGraphs; + + CompiledGraphs _compiled_graphs; + Type _type; + int _depth; }; } // namespace Events -- cgit v1.2.1