I fit a jump threshold on the recorded batch. How much time do I lose on new starts?
I minimize total time across the previous 47 distances. I apply the threshold to 32 disjoint new ranks and measure excess time against the faster method in each pair. I choose the jump from 22 flips onward in this run. I publish 1,504 comparisons aggregated by distance. Measured cost depends on the interpreter and machine state.
I will test threshold stability across independent sessions. AT.EX21.01 · Try the experiment
How far ahead should I jump?
I start from a known rank on nine symbols. When does direct unranking overtake a sequence of flips?
I check both answers against independent decoding on the same 32 starts. I alternate the timing order and record the preparation of the starting point separately. At distance 17 the jump wins 0 of 32 trials on CPython 3.10.11 and 30 on 3.11.7 in my runs. I publish all 47 distances and paired timings.
I will test a selection rule on starts held out from calibration. AT.EX20.01 · Change the inputs.
Direct permutation addresses
Skip suffix reversals
How many swaps would sequential generation need to reach the same permutation?
I place nine symbols on the wheel. The transition from i−1 to i reverses at least k symbols precisely when (k−1)! divides i. The number of such multiples in (a,b] is ⌊b/(k−1)!⌋−⌊a/(k−1)!⌋. Subtracting the next threshold count gives the exact number of length-k flips, including wraparound. Each costs ⌊k/2⌋ pair swaps. I obtain both endpoints directly with the wheel’s Fenwick tree.
From rank 719 to 5,719, the 5,000 transitions need 5,877 swaps. I checked 5,912 transitions against sequential generation on two to seven symbols.
I count bypassed swaps. The runtime of two direct decodes also depends on the implementation. Zaks supplied the ordering and suffix generator.
In the field ZIP, I run python experience/sauts18.py. The matching JSON file contains the reference output.
Change the parameters · AT.EX18.01
APP001 · Supported mathematical construction (XI)
Prior work and my contribution
I give rotation-based reconstruction and a rank witness in Zaks order. Cumulative trees speed up offset lookup.
Limit and next check
Compare Fenwick, Lehmer and Myrvold–Ruskey with output order and big-integer costs stated.
Prior work
Zaks (1984), A new algorithm for generation of permutations · Myrvold & Ruskey (2001), Ranking and unranking permutations in linear time
Historical reference identifiers · F01–F03
Jump or walk to a nearby rank
I sample 32 ranks with seed 19001, compare direct addressing with repeated suffix flips and check each result with a second unranker. I time preparation separately and alternate measurement order. On this machine the walk wins all 32 comparisons at distance 4, and the jump wins all 32 at distance 64. Preparation matters if I do not already have the starting permutation.
Change the inputs · AT.EX19.01 · Zaks (1984)
I reproduce · python sauts19.py
A jump threshold over three sessions
Does the same threshold avoid the same costs after I restart Python? I repeat 32 starting ranks and 47 distances in three successive interpreters. I compare each jump and walk with the independently reconstructed rank. Regret sums extra time relative to the faster measurement in each pair.
At threshold 22 I record total regrets of 79,700, 76,800 and 80,800 ns. These measurements describe CPython 3.10.11 on this machine. I will compare this with dispersion over paired repetitions within sessions. Change parameters · AT.EX22.01
Repeating a walk-or-jump decision
Near the fitted threshold, which decision survives five trials at the same rank? I reuse 32 starts at three distances. I alternate method order across repetitions, check the permutation independently and retain 480 paired timings. A positive difference favors jumping.
At distances 21, 22 and 23 the median of the 32 within-start medians is −1,900, −400 and +250 ns. At distance 22, 28 starts change sign over five trials. These times depend on the session. I will test timing several calls together. Try it · AT.EX23.01
Timing jumps in batches
Does the crossover survive batching the calls? I prepare 32 starts and time five pairs per batch, alternating walking with direct access. I verify every permutation against the reference decoder.
At distance 22 I measure −200 ns per single call, then +187.5 and +253.125 ns per call in batches of 8 and 32 (walk minus jump). These values describe this CPython session. I will test an adaptive rule on held-out starts. Change parameters · AT.EX24.01
Choosing a jump on held-out ranks
At distance 22, does the choice learned for each batch size persist on 32 held-out starts? I reserve 32 new ranks with seed 25001 and time five pairs per batch. The sign of the historical median selects the method. I check every permutation by independent decoding.
I recover the predicted sign for both sizes. In this session, median walk minus jump is −400 ns per single call and +162.5 ns per call in batches of 32. I retain this local setting as a control for another interpreter version. Change parameters · AT.EX25.01
Jump cost under two interpreters
At distance 22, do I still save time by jumping directly to the rank? I replay the same 32 ranks for nine objects, alternate method order, keep five repetitions per batch and check every permutation.
On this machine median walk minus jump changes from −400 to +5,300 ns per call for singletons and from +162.5 to +5,578.125 for batches of 32. These measurements compare two local runs in their respective environments. I will test session order and warm-up effects. Change parameters · AT.EX26.01
Jump versus walk after warm-up
Does the benefit of jumping at distance 22 change when I reverse the sessions? I replay the same 32 ranks under two Python versions. Each process completes a full warm-up. I measure batches of one and 32 in session orders AB and BA.
All eight median walk-minus-jump differences are positive. For singletons they range from 300 to 500 ns under Python 3.10 and from 5,500 to 5,700 ns under Python 3.11 on this machine. I will seek the crossover distance on an independent range of ranks. Change parameters · AT.EX27.01
To repeat the cross-version comparison I run the first Python with sessions27.py --second path_to_second_python. Omitting the option measures the two session orders using one interpreter. I keep the ranks and all paired timings in sessions27.json.
Jump timings on a second rank range
At which distance does recomputing the permutation save time? I reserve 32 ranks in the upper half of 9!, alternate warmed methods and check their outputs with a second decoder.
Across my four sessions jumping wins at every distance from 20 through 24 on Python 3.11.7. On 3.10.11 it loses at 22 for both batch sizes and wins at 24. The rank sample changes the measured decision at 22. I will test a prediction based on the cost of reversed suffixes on held-out ranks. Change parameters · AT.EX28.01
Choosing a jump on held-out ranks
Does total reversed length improve the decision to jump? I learn two thresholds on 160 rank-distance pairs and test them on 160 others. My loss adds the median nanoseconds lost when the selected method is slower.
In my Python 3.10.11 session length reduces training loss from 8,200 to 7,300 ns, but both rules have 5,400 ns held-out regret. I will test the stability of the ranking across independent sessions. Change parameters · AT.EX29.01
Choosing when to jump through permutations
Does the total move length improve my decision to jump or step through ranks? I fit a threshold on 32 ranks and measure regret on 32 new ranks. I repeat with three seed pairs, five distances and a fresh process per pool. Regret adds up the extra time incurred by wrong decisions.
With six pools in six separate processes I measure distance/length regrets of 7,000/6,900, 4,700/2,800 and 900/1,400 ns. A preliminary run on the same ranks in one process produced a tie and two losses for length. The recommendation therefore depends on the session. I will reserve a different interpreter or machine before recommending a rule. Change parameters · AT.EX30.01
Transferring a rank-computation rule
What cost do I incur if I retain a threshold learned in another Python installation? I freeze the thresholds and the ranks drawn from three seed pairs. I sum the excess time for choices that use the slower algorithm.
In all three held-out pools of the 3.11.7 session I measure lower loss for the length rule. Version, distribution and machine load change together. I will reserve a paired run on an idle machine before making a performance recommendation. Change parameters · AT.EX31.01
Comparing thresholds on identical ranks
Does the ordering of the rules survive reversing the order of two Python installations? I retain frozen thresholds and three held-out lists. For each list I measure four processes in ABBA or BAAB order on identical ranks. Loss sums the excess time spent on suboptimal choices.
In this session the length rule has lower median loss in all six installation-pool pairs. I retain the variability of repetitions and the dependency on the machine. I will reserve ranks from outside this generator to test the scope of the rule. Change parameters · AT.EX32.01
I repeat the twelve runs while measuring whole-machine CPU utilisation. I record 47.3% before, 43.7% during and 33.7% after. The median ordering agrees in all six pairs. The observed conditions are those of a shared machine. JSON
Testing a jump rule on other ranks
I retain the trained thresholds and change how permutations are selected. I invert permutations from a regular lexicographic rank grid and use the resulting ranks as machine addresses. I exclude previously seen addresses. I time both strategies in alternating order and calculate the loss of each prescribed choice in nanoseconds.
Across three external pools of 32 ranks, cumulative length gives the lower median loss once and distance twice. The earlier ordering therefore depends on inputs and this session. I will test an abstention rule when losses are small compared with session variability. Change parameters · AT.EX33.01
Historical results — F01 · Factoradic addressing, F02 · Suffix-flip cycle, F03 · Symmetries, XVIII-C02 · Addressing targets by their strip pattern, XIX-C02 · Counting successful signed lifts, XX-C01 · Replaying cuts in a strip, XX-C02 · Changing the sign of an interior strip