I was recently asked, "Do you have some kind of list or simple rules to get high performance generated code using Real-Time Workshop?" I put the question to my colleague (and first guest blogger) Tom Erkkinen, and he came up with the following.
No disrespect to either you or Tom, but as somebody who has developed several large time-critical autocoded applications, I confess I find this list pretty simplistic. In my experience, reducing unnecessary data copying is the biggest potential speedup, which I think is the point of item 6, but item 7 can increase data copying. And replacing state machine with truth tables may be possible for very simple logic flow, but I don’t see as realistic in a large system. Finally, I’d like to see some timing numbers on item 4: modern processors seldom have a significant slowdown on double computations vs float computations (unless you’re using the vector registers, which TMW doesn’t support to my knowledge except in some experimental table lookup code that isn’t readily available at this time).
I guess what I’m really saying is that I’d like to see a more detailed version of each of these and what it’s really getting at.
@KMR – The list was intended to be simple, and to stimulate conversation. So, thanks for that. I agree that more detailed explanation of each of these is in order. I’ll see what kind of simple examples we can pull together to further this discussion. Thanks for the feedback!
One interesting thing to note here seems to be the notion of a http://en.wikipedia.org/wiki/Platform-independent_model vs http://en.wikipedia.org/wiki/Platform-specific_model . To me, at first sight, it seems that at least more separation is needed for some of the above items. E.g. item 6: when rapid prototyping a model on a platform with a lot of resources, I might prefer to use nonvirtual buses (e.g. to improve code readability and ease debugging), whereas, for the final deployment on my embedded hardware, I’d like to use the virtual ones. However, I would like to have these platform choices separately from the model (or at least grouped in the RTW configuration dialog). Thoughts?
Leave a Reply
About
Guy Rouleau and Seth Popinchalk are Application Engineers for MathWorks. They write here about Simulink and other MathWorks tools used in Model-Based Design.
Seth,
No disrespect to either you or Tom, but as somebody who has developed several large time-critical autocoded applications, I confess I find this list pretty simplistic. In my experience, reducing unnecessary data copying is the biggest potential speedup, which I think is the point of item 6, but item 7 can increase data copying. And replacing state machine with truth tables may be possible for very simple logic flow, but I don’t see as realistic in a large system. Finally, I’d like to see some timing numbers on item 4: modern processors seldom have a significant slowdown on double computations vs float computations (unless you’re using the vector registers, which TMW doesn’t support to my knowledge except in some experimental table lookup code that isn’t readily available at this time).
I guess what I’m really saying is that I’d like to see a more detailed version of each of these and what it’s really getting at.
@KMR – The list was intended to be simple, and to stimulate conversation. So, thanks for that. I agree that more detailed explanation of each of these is in order. I’ll see what kind of simple examples we can pull together to further this discussion. Thanks for the feedback!
One interesting thing to note here seems to be the notion of a http://en.wikipedia.org/wiki/Platform-independent_model vs http://en.wikipedia.org/wiki/Platform-specific_model . To me, at first sight, it seems that at least more separation is needed for some of the above items. E.g. item 6: when rapid prototyping a model on a platform with a lot of resources, I might prefer to use nonvirtual buses (e.g. to improve code readability and ease debugging), whereas, for the final deployment on my embedded hardware, I’d like to use the virtual ones. However, I would like to have these platform choices separately from the model (or at least grouped in the RTW configuration dialog). Thoughts?