Post Reply 
HP50g small tips and trick
06-23-2018, 05:43 PM (This post was last modified: 06-23-2018 05:44 PM by pier4r.)
Post: #43
RE: HP50g small tips and trick
(06-23-2018 04:26 PM)rprosperi Wrote:  When you have no idea at all how long a program may run, it's usually best to include a counter to track the number of iterations and when it exceeds some threshold, exit with a diagnostic message, e.g. "Exceeded 10,000 iterations".

Yes that is true. Though I tend to deviate from theory if the task is not critical. (i.e: I am interested in the results but I can wait)

I learned (also through pain) to do sort of canary deployments (principle that is valid mostly everywhere).
Small tests first. Passed? Good.
Then a bit larger. In the meanwhile I collect timings and I see if the predicted runtimes hold varying the input.
Then I let the program crunch large input values.

In my particular case I could predict the next execution time practically with 100% accuracy (and also the number of loops to execute). Only one loop was related to a random pick that in a very remote case could have ended in "sorry no result is there for what you are searching" and then this would have ended in an infinite loop.

I though "well do I make a fail check condition for this? Nah. It won't happen until the input values are really large. By then I will have fixed it". Instead it happened earlier than expected.

Sometimes I have to be remembered of some programming/planning techniques through slightly bitter experiences, to then be motivated to implement them.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP50g small tips and trick - Vtile - 12-13-2016, 11:58 PM
RE: HP50g small tips and trick - tdh79 - 12-19-2016, 11:27 AM
RE: HP50g small tips and trick - franz.b - 06-13-2018, 10:55 AM
RE: HP50g small tips and trick - ttw - 12-19-2016, 07:38 PM
RE: HP50g small tips and trick - Carsen - 01-02-2017, 05:21 AM
RE: HP50g small tips and trick - Vtile - 01-03-2017, 08:55 AM
RE: HP50g small tips and trick - grsbanks - 01-11-2017, 01:29 PM
RE: HP50g small tips and trick - Joe Horn - 01-11-2017, 06:32 PM
RE: HP50g small tips and trick - RichieHH - 06-16-2022, 08:43 PM
RE: HP50g small tips and trick - Vtile - 01-11-2017, 06:05 PM
RE: HP50g small tips and trick - grsbanks - 01-11-2017, 06:56 PM
RE: HP50g small tips and trick - DavidM - 01-11-2017, 09:07 PM
RE: HP50g small tips and trick - Vtile - 01-11-2017, 11:41 PM
RE: HP50g small tips and trick - grsbanks - 01-12-2017, 09:19 AM
RE: HP50g small tips and trick - Vtile - 01-17-2017, 01:30 PM
RE: HP50g small tips and trick - ttw - 02-06-2017, 07:47 PM
RE: HP50g small tips and trick - ttw - 02-20-2017, 09:21 PM
RE: HP50g small tips and trick - C.Ret - 06-14-2018, 07:17 AM
RE: HP50g small tips and trick - TomC - 06-23-2018, 04:50 PM
RE: HP50g small tips and trick - Juan14 - 07-04-2018, 02:55 PM
RE: HP50g small tips and trick - Joe Horn - 07-04-2018, 04:52 PM
RE: HP50g small tips and trick - DavidM - 07-04-2018, 05:39 PM
RE: HP50g small tips and trick - Carsen - 06-13-2018, 08:12 AM
RE: HP50g small tips and trick - Vtile - 06-13-2018, 08:33 PM
RE: HP50g small tips and trick - Carsen - 06-13-2018, 09:34 PM
RE: HP50g small tips and trick - Joe Horn - 06-14-2018, 05:30 AM
RE: HP50g small tips and trick - Vtile - 06-14-2018, 09:30 PM
RE: HP50g small tips and trick - Carsen - 06-14-2018, 06:28 AM
RE: HP50g small tips and trick - rprosperi - 06-14-2018, 12:08 PM
RE: HP50g small tips and trick - Joe Horn - 06-14-2018, 01:09 PM
RE: HP50g small tips and trick - DavidM - 06-14-2018, 02:27 PM
RE: HP50g small tips and trick - Joe Horn - 06-15-2018, 02:15 PM
RE: HP50g small tips and trick - Carsen - 06-15-2018, 08:36 AM
RE: HP50g small tips and trick - Joe Horn - 06-15-2018, 03:20 PM
RE: HP50g small tips and trick - Carsen - 06-16-2018, 08:40 AM
RE: HP50g small tips and trick - Joe Horn - 06-16-2018, 06:15 PM
RE: HP50g small tips and trick - pier4r - 06-16-2018, 07:15 PM
RE: HP50g small tips and trick - DavidM - 06-16-2018, 09:26 PM
RE: HP50g small tips and trick - grsbanks - 06-17-2018, 07:59 AM
RE: HP50g small tips and trick - DavidM - 06-17-2018, 02:29 PM
RE: HP50g small tips and trick - Vtile - 06-17-2018, 07:01 PM
RE: HP50g small tips and trick - pier4r - 06-23-2018, 03:15 PM
RE: HP50g small tips and trick - rprosperi - 06-23-2018, 04:26 PM
RE: HP50g small tips and trick - pier4r - 06-23-2018 05:43 PM
RE: HP50g small tips and trick - TomC - 06-23-2018, 05:02 PM
RE: HP50g small tips and trick - DavidM - 06-23-2018, 05:35 PM
RE: HP50g small tips and trick - pier4r - 08-08-2018, 09:25 AM
RE: HP50g small tips and trick - pier4r - 08-08-2018, 11:18 AM



User(s) browsing this thread: 1 Guest(s)