Commit 897a3ec
committed
Experiment 8: head-to-head benchmark of three search algorithms
Settles the PHI_PI_FIB_ALGORITHM.md vs TIER_4_HONEST_REVISION.md
contradiction empirically by running all three algorithms under the
same OMC harness.
New surface in phi_pi_fib.rs:
phi_pi_fib_search_v2(arr, target) - the F(k)/phi^(pi*k)
split-point algorithm from
PHI_PI_FIB_ALGORITHM.md.
Falls back to binary search
when the offset rounds to 0.
log_phi_pi_fibonacci(n) - the theoretical bound
ln(n) / (pi * ln(phi))
~= 0.459 * log2(n).
log_phi(n) - kept, marked #[deprecated]
in favor of log_phi_pi_fibonacci.
Four new OMC builtins so experiments can call any algorithm:
phi_pi_fib_search_v2(arr, target)
phi_pi_fib_nearest_v2(arr, target)
phi_pi_bin_search(arr, target)
log_phi_pi_fibonacci(n)
Head-to-head bench (500 queries per N, random integer targets):
N | fib-step | phi-pi-fib-v2 | binary | log2(N) | log_phi_pi_fib(N)
-------+----------+---------------+--------+---------+------------------
16 | 5.47 | 4.15 | 3.82 | 4.0 | 1.83
64 | 8.18 | 7.03 | 5.61 | 6.0 | 2.75
256 | 10.45 | 9.83 | 7.58 | 8.0 | 3.67
1024 | 12.75 | 13.76 | 9.49 | 10.0 | 4.58
4096 | 13.85 | 16.69 | 11.45 | 12.0 | 5.50
16384 | 16.32 | 19.75 | 13.49 | 14.0 | 6.42
65536 | 18.28 | 23.86 | 15.54 | 16.0 | 7.34
Race over N=65536 with 2000 fixed-seed queries each:
fib-step: 36,875 compares
phi-pi-fib-v2: 47,458 compares (28.7% more than fib-step)
binary search: 31,058 compares (the winner)
Pairwise ratios:
v2 / binary = 1.528
fib / binary = 1.187
v2 / fib = 1.287
Binary search wins decisively at every N. v2's unbalanced probe
positions waste comparison information; it actually does WORSE than
fib-step at N >= 1024.
The theoretical log_phi_pi_fibonacci(N) ~= 0.46 * log2(N) is BELOW
the information-theoretic minimum log2(N), so it was never achievable
in single-comparison sequential code. TIER_4_HONEST_REVISION.md was
empirically correct.
What this means for the substrate refactor: phi_pi_fibonacci is the
right ARCHITECTURAL FRAMING (attractor sets, naming, conceptual unit),
but the LOOKUP PRIMITIVE in the unified substrate should be binary
search. Holding off on the refactor for your review.
Both engines audit byte-identical (1759 bytes). 148/148 tests pass
after fixing two new rustdoc tests that mis-parsed indented math
blocks as Rust code.1 parent a9232e0 commit 897a3ec
3 files changed
Lines changed: 394 additions & 10 deletions
File tree
- experiments/hybrid_llm
- omnimcode-core/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1663 | 1663 | | |
1664 | 1664 | | |
1665 | 1665 | | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1666 | 1669 | | |
1667 | 1670 | | |
1668 | 1671 | | |
| |||
4027 | 4030 | | |
4028 | 4031 | | |
4029 | 4032 | | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
| 4057 | + | |
| 4058 | + | |
| 4059 | + | |
| 4060 | + | |
| 4061 | + | |
| 4062 | + | |
| 4063 | + | |
| 4064 | + | |
| 4065 | + | |
| 4066 | + | |
| 4067 | + | |
| 4068 | + | |
| 4069 | + | |
| 4070 | + | |
| 4071 | + | |
| 4072 | + | |
| 4073 | + | |
| 4074 | + | |
| 4075 | + | |
| 4076 | + | |
| 4077 | + | |
| 4078 | + | |
| 4079 | + | |
| 4080 | + | |
| 4081 | + | |
| 4082 | + | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
| 4099 | + | |
| 4100 | + | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
| 4113 | + | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
| 4119 | + | |
| 4120 | + | |
| 4121 | + | |
| 4122 | + | |
| 4123 | + | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
| 4130 | + | |
| 4131 | + | |
| 4132 | + | |
| 4133 | + | |
| 4134 | + | |
| 4135 | + | |
4030 | 4136 | | |
4031 | 4137 | | |
4032 | 4138 | | |
| |||
4994 | 5100 | | |
4995 | 5101 | | |
4996 | 5102 | | |
| 5103 | + | |
| 5104 | + | |
4997 | 5105 | | |
4998 | 5106 | | |
4999 | 5107 | | |
| |||
0 commit comments