I'm building a Simulink model that's going to be a referenced as a Reference Model inside a larger simulation. The only function thing that's inside this model is a single "MATLAB Function" block that calls a piece of Matlab code. The Matlab code takes in about 15 inputs and puts out about 200 outputs. (I'm putting it in a Reference Model so that it won't have to re-compile when other things in the larger simulation are changed).
I've got two implementations of this model right now: one where the MATLAB Function Block uses all scalar I/O (mostly doubles, but a few integers and booleans as well) and one where it uses a nonvirtual bus for both input and output. In both models, the runtime of the MATLAB Function Block is essentially identical (~0.3 seconds for 1000 time-steps). The runtime of the whole model of the "scalar I/O" version is about 30x longer, though, because of all of those 200ish outport blocks (~15s for the scalar version vs. ~0.5s for the bus version). The Simulink profiler says that each Outport block requires around 0.03-0.07 sec per 1000 steps to execute.
Is there any way to improve the performance of using large numbers of outports like this? The "bus" version is certainly a much cleaner-looking model, but I don't really care about that right now. What makes the bus version painful is that it requires me to have a nonvirtual bus definition file for every Reference Model that I implement like this, which is going to start to get very busy. But if I can't get the runtimes reasonably comparable, I don't really have a choice.