Is the regression caused the overhead of printf (possibly delaying the decision by a non-negligible amount of time) or it's because of the change in thresholds (resulting in smaller blocks being written to the card)?
Results of over 30 hours of benchmarking (Apr29 codebase with minor changes - included in the raw log - to check the effect of these changes on performance). During this time, the camera was under the control of
this script, unattended.
mlv_lite version : ML/MODULES/RAWBENCH/ASSUMEFS.MO: 865 frames (772 ... 925)
mlv_lite version : ML/MODULES/RAWBENCH/APR29.MO: 866 frames (789 ... 900)
mlv_lite version : ML/MODULES/RAWBENCH/NOPRINTF.MO: 874 frames (795 ... 902)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME70.MO: 885 frames (840 ... 956)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME80.MO: 938 frames (866 ... 984)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME90.MO: 946 frames (846 ... 986)
The effect of printf is not significant (could
not prove the version without printf is any faster):
Quartile stats: median (Q1 ... Q3)
mlv_lite version : ML/MODULES/RAWBENCH/APR29.MO: 866 frames (789 ... 900)
mlv_lite version : ML/MODULES/RAWBENCH/NOPRINTF.MO: 874 frames (795 ... 902)
P =
1 0.63117
0.63117 1
T =
0 -0.48056
0.48056 0
But, the assumed write speed (when deciding to limit the number of frames saved in a single file write call, to avoid running out of space during the call) appears to have a sweet spot between 80 and 90%:
Quartile stats: median (Q1 ... Q3)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUMEFS.MO: 865 frames (772 ... 925) ; ASSUME100
mlv_lite version : ML/MODULES/RAWBENCH/NOPRINTF.MO: 874 frames (795 ... 902) ; ASSUME50
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME70.MO: 885 frames (840 ... 956)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME80.MO: 938 frames (866 ... 984)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME90.MO: 946 frames (846 ... 986)
P =
Columns 1 through 4:
1 0.4984 6.2291e-07 7.7958e-10
0.4984 1 6.194e-05 7.2981e-07
6.2291e-07 6.194e-05 1 0.06076
7.7958e-10 7.2981e-07 0.06076 1
1.7948e-08 4.1919e-06 0.11062 0.86482
Column 5:
1.7948e-08
4.1919e-06
0.11062
0.86482
1
T =
0 -0.67773 -5.0558 -6.2829 -5.7438
0.67773 0 -4.0546 -5.0451 -4.6852
5.0558 4.0546 0 -1.8798 -1.5988
6.2829 5.0451 1.8798 0 0.17034
5.7438 4.6852 1.5988 -0.17034 0
So, while the first place (which assumes 90% of the measured speed for the last file write calls) is clearly better (squeezes more frames) compared to last two places (which assume either 100% or 50% of the measured speed for the same calls), we cannot tell the same about the first two winners - they are tied (could not prove one is faster than the other). Same for the last two places. The sweet spot is probably somewhere near 85% (not tested, just guessed).

However, the best thing to do for speed is to write blocks as large as we can (in other words, as few file write calls as we can), and free the buffers as soon as we know they have been written. Here's an experiment on this:
Quartile stats: median (Q1 ... Q3)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME80.MO: 938 frames (866 ... 984)
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME90.MO: 946 frames (846 ... 986)
mlv_lite version : ML/MODULES/RAWBENCH/SPECFREE.MO: 1015 frames (921 ... 1090)
P =
1 0.86482 3.7192e-14
0.86482 1 2.8011e-13
3.7303e-14 2.8022e-13 1
T =
0 0.17034 -7.8429
-0.17034 0 -7.5833
7.8429 7.5833 0
With large blocks, and reusing image buffers *during* a file write call, performance is clearly better (possibly also helping with overall speed, as the large buffers are freed and can be reused quicker).
(this experiment is a litte risky in my opinion, as I have not tested it for data integrity, other than self-checks built in mlv_lite, so I'm not comfortable including it in the builds,
but you can build it from source - diffs available in the raw log)
Number of frames recorded by each build:
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME70.MO
832,1060,989,959,869,953,898,895
741,837,839,827,921,767,905,985
732,703,836,944,954,949,830,800
739,864,926,961,956,949,866,866
840,983,870,747,856,848,972,896
762,870,987,853,978,953,876,852
647,880,876,917,984,895,1002,886
555,871,966,919,882,1028,976,791
651,939,852,868,1063,863,872,925
737,977,989,974,958,973,855,846
756,871,974,978,969,994,953,791
849,860,1023,974,997,979,993,943
765,758,964,1004,1013,942,986,824
823,835,864,955,969,832,847,877
744,997,844,839,1039,951,941,880
773,884,904,985,974,619,833,778
850,1018,947,857,942,868,1011,901
637,990,723,930,757,837,806,872
756,952,977,856,965,950,956,883
647,870,828,946,938,868,832,879
750,904,944,942,863,976,872,843
626,760,986,975,937,755,838,986
540,851,764,874,1036,1048,1052,836
655,856,878,747,928,763,843,905
626,829,953,912,966,822,997,952
804,893,884,840,902,939,933,937
754,943,905,988,874,962,897,952
885,966,885,971,950,984,872,874
843,955,848,887,871,953,861,950
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME90.MO
665,1025,986,985,1000,882,993,698
683,992,993,918,946,1026,906,781
463,854,720,907,982,1040,1052,834
828,777,806,956,1001,967,879,800
555,851,876,859,807,986,881,944
589,986,997,979,962,1003,918,856
762,961,945,888,916,966,998,866
689,906,970,975,826,975,684,972
474,898,982,1008,982,982,990,978
582,889,963,1010,1007,1044,994,765
782,904,978,964,1002,965,841,928
710,966,1018,802,989,903,981,952
882,992,974,918,1013,961,1018,1039
762,922,963,1009,1024,961,971,970
765,903,922,948,1011,975,903,874
679,917,904,992,965,916,962,985
876,902,805,865,874,761,727,966
745,981,1061,890,737,1002,1095,783
831,875,837,992,711,940,1031,975
581,651,976,901,1055,1005,922,901
659,946,978,971,997,914,816,954
773,989,968,979,987,798,1010,964
858,841,685,793,993,812,987,980
654,997,983,891,1036,918,997,899
mlv_lite version : ML/MODULES/RAWBENCH/NOPRINTF.MO
572,818,859,843,691,827,898,805
880,920,893,799,896,794,826,981
781,973,995,916,877,777,874,893
776,891,907,896,799,914,894,697
768,796,918,890,902,715,810,792
680,824,899,901,916,860,896,718
466,641,900,848,907,836,870,959
678,576,891,917,698,889,921,813
862,850,797,943,871,892,969,882
801,879,898,898,779,905,936,768
581,930,916,1008,892,872,895,908
440,720,919,896,890,906,831,1016
571,797,883,861,985,875,845,793
686,784,906,891,877,974,869,742
772,874,857,916,968,775,801,786
mlv_lite version : ML/MODULES/RAWBENCH/ASSUMEFS.MO
690,1040,864,754,879,861,935,972
523,728,833,969,935,944,971,1054
404,819,957,836,778,845,881,514
796,886,779,776,917,957,892,760
361,763,1003,597,929,743,907,983
758,868,875,859,971,979,999,934
848,803,794,777,883,861,669,681
612,746,879,904,774,942,972,950
572,789,555,769,862,786,918,823
534,792,847,859,865,910,980,738
838,935,980,915,850,879,670,785
561,863,954,780,809,875,940,907
795,964,1003,891,955,870,636,813
460,733,980,974,1037,1072,874,801
873,908,937,838,855,801,909,891
753,834,877,881,948,910,935,1050
856,874,941,764,873,920,585,884
666,638,709,947,857,947,884,906
576,967,818,985,660,798,774,1001
711,889,799,900,869,837,810,836
667,790,886,871,798,872,837,886
602,887,922,721,929,706,949,936
358,882,724,824,882,689,876,700
438,693,928,789,860,888,869,867
606,826,748,782,870,908,877,858
551,523,933,760,930,711,911,965
674,847,732,957,958,765,888,957
665,731,881,1012,986,933,914,995
mlv_lite version : ML/MODULES/RAWBENCH/APR29.MO
532,631,813,903,892,905,876,1030
768,715,803,718,949,826,893,892
807,977,930,799,889,821,887,775
410,803,852,984,603,777,900,883
653,802,984,707,774,889,858,815
703,899,707,866,793,825,841,987
696,987,926,883,966,896,869,945
766,900,887,789,867,788,890,897
801,860,969,972,839,840,909,890
682,906,793,897,894,915,911,911
509,756,807,811,945,1003,984,780
678,808,716,809,806,827,925,932
501,770,852,905,951,878,632,887
737,899,870,981,959,939,888,798
662,886,919,760,782,684,808,947
664,884,719,685,882,804,822,884
861,824,795,693,991,868,814,888
686,886,895,880,870,712,914,861
662,888,804,828,910,966,947,817
667,820,961,784,904,842,900,884
561,795,873,784,949,739,756,768
557,896,880,804,903,921,802,911
695,865,905,863,885,911,865,885
670,972,868,908,850,877,868,881
mlv_lite version : ML/MODULES/RAWBENCH/ASSUME80.MO
490,483,716,909,1020,996,991,814
663,982,999,925,983,1004,974,898
890,923,822,1015,879,987,857,882
911,984,960,971,952,964,974,674
847,932,978,911,1003,985,980,998
783,986,984,925,981,955,995,871
872,970,871,970,788,913,1027,1086
678,872,873,843,980,980,995,894
766,919,971,758,806,813,1002,933
657,891,969,974,939,968,1023,963
650,996,989,995,975,984,982,899
780,703,997,1014,936,937,881,834
760,955,966,772,989,980,866,990
926,939,972,1013,981,960,1010,767
676,1014,925,987,1007,897,908,763
667,1027,801,890,985,767,1001,797
758,912,866,1015,876,976,891,770
466,910,772,941,981,755,979,742
889,973,941,1014,969,968,667,756
640,908,958,994,972,977,882,888
793,889,986,986,1004,1000,983,1069
752,991,1029,868,884,987,906,784
630,881,879,982,955,926,836,841
517,772,922,1023,1034,852,898,985
856,943,835,885,805,992,971,1006
684,952,975,1015,863,987,996,892
561,975,890,978,985,1019,904,975
559,954,909,922,902,1124,982,929
783,1019,935,1035,971,996,884,962
mlv_lite version : ML/MODULES/RAWBENCH/SPECFREE.MO
973,1083,1029,908,1121,1011,1110,718
794,1132,1023,853,908,1098,1114,1004
791,1066,899,920,958,1086,1197,811
857,1135,1034,1097,996,937,1006,921
819,1066,970,995,1063,1021,1113,1078
641,1095,1076,992,996,1078,1015,892
932,1111,1003,1109,1072,974,1007,1084
796,1009,1098,1114,1121,1000,717,881
910,928,1012,917,1055,1085,1073,820
617,970,1141,996,1031,1102,1022,1012
790,1010,1072,1017,1023,1043,1034,922
910,1140,920,1106,1116,1126,989,919
791,772,1016,1024,1110,1123,1096,832
802,1013,961,1097,1120,1057,1103,971
754,984,1081,1078,1176,907,908,602
848,1100,1115,1089,1111,1102,908,935
1016,1106,1017,1013,1104,1045,1007,982
713,1057,987,997,1037,954,1095,925
992,1101,1084,1076,1068,1024,1095,920
790,911,1128,1121,1096,1020,1010,600
808,938,1096,978,1042,919,1099,910
837,982,1100,1077,1080,1015,1039,917
769,1006,1083,1091,1102,1090,915,981
Raw log (includes diffs)