Skip to content

Commit 05d957f

Browse files
authored
Update LexCHA.cpp
1 parent 0bb7fc3 commit 05d957f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

FullPermutation/LexCHA.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,28 @@ int main(int argc, char* argv[]) {
9696

9797
precompute_only_flat_lut_N5();
9898

99-
// Standard baseline (factorial-based approximation for speed)
99+
// Standard baseline
100100
auto s1 = std::chrono::high_resolution_clock::now();
101101
unsigned long long c1 = 1; for(int i=1; i<=N; ++i) c1 *= i;
102102
auto e1 = std::chrono::high_resolution_clock::now();
103103
double d1 = std::chrono::duration<double>(e1 - s1).count();
104-
if(d1 == 0) d1 = 1e-9; // Prevent division by zero
104+
if(d1 < 1e-9) d1 = 1e-9;
105105

106106
// Accelerated run
107107
auto s2 = std::chrono::high_resolution_clock::now();
108108
unsigned long long c2 = benchmark_accelerated(N);
109109
auto e2 = std::chrono::high_resolution_clock::now();
110110
double d2 = std::chrono::duration<double>(e2 - s2).count();
111+
if(d2 < 1e-9) d2 = 1e-9;
111112

112-
// Output raw data: N, Std(s), Acc(s), Std_ns/perm, Acc_ns/perm, Speedup
113+
// Use space-separated values for perfect AWK parsing
114+
// Format: N Std(s) Acc(s) Std_ns/perm Acc_ns/perm Speedup
113115
std::cout << N << " "
114-
<< d1 << " "
116+
<< std::fixed << std::setprecision(6) << d1 << " "
115117
<< d2 << " "
116118
<< (d1 * 1e9) / c1 << " "
117119
<< (d2 * 1e9) / c2 << " "
118-
<< d1/d2 << "x" << std::endl;
120+
<< d1/d2 << std::endl;
119121

120122
return 0;
121123
}

0 commit comments

Comments
 (0)