exceptions and optimization

Nicholas Wilson iamthewilsonator at hotmail.com
Mon Oct 21 22:26:41 UTC 2019


On Monday, 21 October 2019 at 21:09:32 UTC, Peter Jacobs wrote:
> On Monday, 21 October 2019 at 20:37:32 UTC, Nicholas Wilson 
> wrote:
>>
>> What kind of conditions are you wanting to throw exception on? 
>> infinities, NaNs, ill conditioning, something else?
>>
>> As always the best way to check is to mark the function of 
>> interest, nothrow take a look at the disassembly and compare 
>> to without nothrow. You may also want to look to the 
>> optimisation summary that I _think_ you can get LDC to 
>> generate.
>
> Our methods take a few short cuts and occasionally step over a 
> stability boundary, so I guess that it may look like 
> ill-conditioning.

The reason I asked that is to see what sort of action you take 
because there may be better architectures that you can use to 
handle that kind of change.

For example, you are integrating with some scheme and hit a 
region of high curvature and need to rollback and change scheme 
(to either a less coarse time step or better integrator). In 
which case it may be best to take a page out of databases and use 
a change-commit kind of approach to short circuit through your 
calculations and if at the end of your update loop a flag is set 
that says this update is invalid then retry with another scheme.

> Thank you for the explanation and suggestions.



More information about the Digitalmars-d-learn mailing list