[m-rev.] for review: Make modecheck_conj_list_flatten_and_schedule tail recursive.

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Oct 15 16:52:58 AEDT 2015



On Thu, 15 Oct 2015 14:28:25 +1100, Peter Wang <novalazy at gmail.com> wrote:
> +        reverse_prepend(ScheduledSolverGoals, !RevGoals),

I think the idea behind the change is fine. However, I have found that
playing games like this, reversing a list that is already in the correct order
in order to preemptively undo a reverse that will be applied to the result later
just makes maintenance unnecessarily hard, because the mental gymnastics
required to figure out what is reversed and what is not makes it harder to
think about the actual work being done. I would much rather we used
cords here, and in similar places, and accept that there may be a very small
performance penalty. Although it is also possible that there will be a speedup.
For example, we wouldn't have to reverse the list here, so at this point
in the code, cords would have an O(1) cost, not O(n).

By the way, may I ask what motivates this spate of changes to handle
large programs? I am interested in the subject, since I did a whole bunch
of such changes earlier. Maybe I can help.

Zoltan.


More information about the reviews mailing list