Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
Parent: MorphoOptimizationProject |
Parent: [[MorphoOptimizationProject]] When replacing one algorithm with another, it is very easy to introduce tiny differences that cause later code to produce visibly different results. Rather than just comparing the final results, which does not help with debugging, it is best to compare the intermediate results either immediately after the algorithm or, ideally, during the execution of the algorithm - this will greatly assist debugging any differences. To this end, the following outline of a change seems to work well === Add the new code with very few changes to the old === eg. void algorithm(''args'') { ... } becomes void algorithm_old(''args'') {...} void algorithm_new(''args'') {...} void algorithm(''args'') { bool do_old = !!getenv("FREESURFER_algorithm_old"); bool do_new = !!getenv("FREESURFER_algorithm_new") || !do_old; if (do_old) algorithm_old(''args'') if (do_new) algorithm_new(''args'') } |
Parent: MorphoOptimizationProject
When replacing one algorithm with another, it is very easy to introduce tiny differences that cause later code to produce visibly different results.
Rather than just comparing the final results, which does not help with debugging, it is best to compare the intermediate results either immediately after the algorithm or, ideally, during the execution of the algorithm - this will greatly assist debugging any differences.
To this end, the following outline of a change seems to work well
Add the new code with very few changes to the old
eg.
void algorithm(args) { ... }
becomes
void algorithm_old(args) {...}
void algorithm_new(args) {...}
void algorithm(args) {
- bool do_old = !!getenv("FREESURFER_algorithm_old");
bool do_new = !!getenv("FREESURFER_algorithm_new") || !do_old; if (do_old) algorithm_old(args) if (do_new) algorithm_new(args)
- bool do_old = !!getenv("FREESURFER_algorithm_old");