﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3568	Performance issues in DIVISION_SIM	Federico Bergero	somebody	"Hi all, I'm running a model that has lot of divisions.
The C generated code inserts the macro DIVISION_SIM for each division. This macro (as far as I understand) checks for zero and allows zero division at initialization (when initial()==1).

This is OK for user-friendliness but in my case I see a ~50% performance penalty for these checks. My model has no division by zero.

Using the original DIVISION_SIM macro the simulation takes 26.81 seconds.

If I replace this macro for the normal division it takes 14.15 s.

Are these checks necessary for something else than showing a meaningful error message? If no, perhaps  using the division 
should be the by-default behavior showing a not-so meaningful ""Division by zero"" message and asking the user to run the model with a specific flag that includes the check.

Also the check of initial() is not necessary after the initialization. Perhaps the equations could be split into initials allowing division by zero, and dynamic ones not allowing it but without checking initial() on every division.

What you guys think?




"	discussion	new	low	Future	Run-time				Francesco Casella Adrian Pop Willi Braun
