Commit graph

1577 commits

Author SHA1 Message Date
Loric ANDRE 94c132a94f release: v4.2.0 2026-03-30 13:58:19 +02:00
LoricAndre 987d2a5ca7
feat: add multiline item rendering (#999)
* feat: add multiline item rendering

* chore: generate completions & manpage

* chore: use newline as default for multiline when read0 is set

* chore: generate completions & manpage

* chore: add `highlight-line'

* chore: generate completions & manpage

* feat: use multiline in history widgets

* feat: better snap tests

* feat(ci): show snap failures

* fix(ci): cross platform tests

---------

Co-authored-by: Skim bot <skim-bot@skim-rs.github.io>
2026-03-30 13:57:09 +02:00
Loric ANDRE 7e5d441e4c release: v4.1.0 2026-03-30 10:09:55 +02:00
LoricAndre 9d12e9d420
feat: windows support (#1010)
* wip: windows support

* feat: windows support

* feat: add windows target to CI

* chore: generate completions & manpage

* Update src/util.rs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* chore: cleanup & doc

* chore: generate completions & manpage

* chore: generate dist

* fix: reduplicate default test

* chore: regate tmux

* chore: remove useless test-utils feature

* fix(windows): ignore dirs in default_command

* docs: update shell docs for windows

* chore: generate completions & manpage

* chore(justfile): do not ignore failed tests

* fix: upload correct junit after profile change

* fix: always execute exit commands

* fix: windows-specific ctrl-c handling

* chore: misc docs & other updates

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* chore: generate completions & manpage

* chore: include license in MSI installer

---------

Co-authored-by: Skim bot <skim-bot@skim-rs.github.io>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
2026-03-29 21:46:42 +00:00
Loric ANDRE 65c2dcde11 fix: trim whitespace in zsh hist widget (closes #1019) 2026-03-29 23:14:44 +02:00
Loric ANDRE 6332195605 fix: broken pipe in bash alt-c (closes #1018) 2026-03-29 17:57:56 +02:00
Loric ANDRE eb5d5df44b chore: minor perf 2026-03-29 17:41:47 +02:00
Loric ANDRE 78231e5244 chore: refactor engine building 2026-03-28 12:19:12 +01:00
Loric ANDRE 90e23eb86e release: v4.0.1 2026-03-28 10:10:50 +01:00
dependabot[bot] 3757038aa4
chore(deps): bump clap_complete_nushell from 4.5.10 to 4.6.0 (#1013)
Bumps [clap_complete_nushell](https://github.com/clap-rs/clap) from 4.5.10 to 4.6.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete_nushell-v4.5.10...clap_complete_nushell-v4.6.0)

---
updated-dependencies:
- dependency-name: clap_complete_nushell
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: LoricAndre <57358788+LoricAndre@users.noreply.github.com>
2026-03-28 09:51:57 +01:00
dependabot[bot] cb037fbe27
chore(deps): bump roff from 1.0.0 to 1.1.0 (#1014)
Bumps [roff](https://github.com/rust-cli/roff-rs) from 1.0.0 to 1.1.0.
- [Changelog](https://github.com/rust-cli/roff-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/roff-rs/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: roff
  dependency-version: 1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: LoricAndre <57358788+LoricAndre@users.noreply.github.com>
2026-03-28 09:51:42 +01:00
dependabot[bot] 2a77f6b4c1
chore(deps): bump env_logger from 0.11.9 to 0.11.10 (#1012)
Bumps [env_logger](https://github.com/rust-cli/env_logger) from 0.11.9 to 0.11.10.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.11.9...v0.11.10)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-version: 0.11.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: LoricAndre <57358788+LoricAndre@users.noreply.github.com>
2026-03-28 09:51:32 +01:00
Loric ANDRE 7654782d64 chore: remove sonar 2026-03-28 09:41:58 +01:00
Loric ANDRE a8c56626bc chore: set rust msrv (closes #1017) 2026-03-28 09:38:28 +01:00
Douglas Griffith b9c3de302b
replace undefined awk behaviour (#1016)
I encountered a bug with the CTRL-R history behaviour in bash, and tracked it down to these awk commands. I'm not sure what changed, but according to the documentation `\0` is undefined behaviour:
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/awk.html#tagtcjh_15

I've replaced the `\0` escape sequences with the `%c` conversion which converts the int argument to a single byte character. Ref:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap05.html
2026-03-26 23:20:43 +01:00
Loric ANDRE c0a9be6b5f fix(keybindings): make sure we use the correct filtering fields 2026-03-23 23:19:10 +01:00
Loric André d40af611b6 chore(ci): add sonar directly to test workflow 2026-03-19 21:29:15 +01:00
dependabot[bot] 1fd6292bbe
chore(deps): bump clap_complete from 4.5.66 to 4.6.0 (#1005)
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.5.66 to 4.6.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.66...clap_complete-v4.6.0)

---
updated-dependencies:
- dependency-name: clap_complete
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-19 15:55:17 +00:00
dependabot[bot] b74ed55946
chore(deps): bump clap from 4.5.60 to 4.6.0 (#1006)
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.60 to 4.6.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.60...clap_complete-v4.6.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-19 15:44:48 +00:00
dependabot[bot] 257f0185b0
chore(deps): bump tempfile from 3.26.0 to 3.27.0 (#1004)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.26.0 to 3.27.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.26.0...v3.27.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-version: 3.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-19 15:36:05 +00:00
dependabot[bot] 9626606745
chore(deps): bump clap_mangen from 0.2.31 to 0.2.33 (#1007)
* chore(deps): bump clap_mangen from 0.2.31 to 0.2.33

Bumps [clap_mangen](https://github.com/clap-rs/clap) from 0.2.31 to 0.2.33.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_mangen-v0.2.31...clap_mangen-v0.2.33)

---
updated-dependencies:
- dependency-name: clap_mangen
  dependency-version: 0.2.33
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: generate completions & manpage

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Skim bot <skim-bot@skim-rs.github.io>
2026-03-19 16:27:04 +01:00
dependabot[bot] 96f3320b15
chore(deps): bump frizbee from 0.8.2 to 0.8.3 (#1008)
Bumps [frizbee](https://github.com/saghen/frizbee) from 0.8.2 to 0.8.3.
- [Commits](https://github.com/saghen/frizbee/compare/v0.8.2...v0.8.3)

---
updated-dependencies:
- dependency-name: frizbee
  dependency-version: 0.8.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-19 16:26:36 +01:00
LoricAndre 7ae0802979
chore: add sonar analysis (#1009)
* chore: add sonar analysis

* chore: add sonar config
2026-03-19 16:25:38 +01:00
d 5028ef4d0b
chore: correct typos in code, comments and documentation (#1002)
* fix: correct typos in code, comments and documentation

* chore: generate completions & manpage

---------

Co-authored-by: Skim bot <skim-bot@skim-rs.github.io>
2026-03-12 10:19:25 +00:00
LoricAndre 926c76ee16
docs: add benchmarks to README.md [skip ci] 2026-03-11 15:31:08 +01:00
Loric ANDRE a1f420a682 chore: clippy pedantic 2026-03-10 20:33:19 +01:00
Loric ANDRE 85c6964da5 release: v4.0.0 2026-03-10 16:25:28 +01:00
dependabot[bot] 4269838f32
chore(deps): bump which from 8.0.0 to 8.0.2 (#1000)
Bumps [which](https://github.com/harryfei/which-rs) from 8.0.0 to 8.0.2.
- [Release notes](https://github.com/harryfei/which-rs/releases)
- [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/harryfei/which-rs/compare/8.0.0...8.0.2)

---
updated-dependencies:
- dependency-name: which
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-10 16:02:40 +01:00
Loric ANDRE 95f09a455a chore: use python for bench script for comparison 2026-03-10 16:01:54 +01:00
Loric ANDRE 5b0323a9fb feat!: use Arinae as default algorithm
=== Results: ./target/release/sk [baseline] ===
Completed runs: 50 / 50
Average items matched: 2895782 / 10000000  (min: 2895782, max: 2895782)
Average time: 3.827s  (min: 3.576s, max: 4.090s)
Average items/second: 2615767  (min: 2445033, max: 2796365)
Average peak memory usage: 1589.2 MB  (min: 1518.6 MB, max: 1661.2 MB)
Average peak CPU usage: 528.9%  (min: 457.0%, max: 740.0%)

=== Results: /home/loric/.local/share/cargo/bin/sk ===
Completed runs: 50 / 50
Average items matched: 2895782 / 10000000  (min: 2895782, max: 2895782)
+0.0%
Average time: 3.930s  (min: 3.565s, max: 4.226s)  +2.7%
Average items/second: 2548674  (min: 2366263, max: 2804816)  -2.6%
Average peak memory usage: 1618.8 MB  (min: 1539.1 MB, max: 1680.6 MB)
+1.9%
Average peak CPU usage: 696.8%  (min: 608.0%, max: 875.0%)  +31.7%

=== Results: /home/loric/.nix-profile/bin/fzf ===
Completed runs: 50 / 50
Average items matched: 2895782 / 10000000  (min: 2895782, max: 2895782)
+0.0%
Average time: 5.421s  (min: 4.814s, max: 6.111s)  +41.7%
Average items/second: 1848269  (min: 1636444, max: 2077385)  -29.3%
Average peak memory usage: 2015.3 MB  (min: 1860.7 MB, max: 2173.9 MB)
+26.8%
Average peak CPU usage: 1301.1%  (min: 1229.0%, max: 1431.0%)  +146.0%

=== Comparison Summary (vs baseline: ./target/release/sk) ===
Binary                                       Avg time     Δ time
Avg rate     Δ rate
------------------------------------------------------------------------------------------
./target/release/sk                            3.827s   baseline
2615767   baseline
/home/loric/.local/share/cargo/bin/sk          3.930s      +2.7%
2548674      -2.6%
/home/loric/.nix-profile/bin/fzf               5.421s     +41.7%
1848269     -29.3%
2026-03-10 15:59:59 +01:00
Loric ANDRE 86d824e6cf chore!: default to disabled typos 2026-03-10 14:14:07 +01:00
LoricAndre ab514a54c9
feat!: internally compute indexes at match time (removes get/set_index) (#1001)
* chore: remove skim::Item run_items wrapper

* fix: properly trigger re-render on custom previews

* feat: add AppendItems event

* feat!: internally compute indexes at match time (removes get/set_index)

* chore: generate completions & manpage

* chore: better benchmarks

---------

Co-authored-by: Skim bot <skim-bot@skim-rs.github.io>
2026-03-10 14:12:10 +01:00
Loric ANDRE 0ac1ac878d release: v3.7.0 2026-03-08 19:18:55 +01:00
Loric ANDRE 7d2efaf87f chore: review snapshots 2026-03-08 18:57:55 +01:00
Loric ANDRE 9c9e15c97b feat: add Skim::run_items API 2026-03-08 18:46:12 +01:00
Loric ANDRE 396f2953a9 chore: add gungraun benchmark 2026-03-07 15:45:34 +01:00
Loric ANDRE 349533fa1b fix: correctly init rank for and engine 2026-03-05 10:09:34 +01:00
Loric ANDRE e891a49ebe fix: use sum of scores in And engine 2026-03-05 09:30:38 +01:00
Loric ANDRE 0bf6e8fb32 feat: add scheme for better filepath matching in Arinae 2026-03-05 09:30:38 +01:00
Loric ANDRE 17adb040ac release: v3.6.2 2026-03-04 21:07:29 +01:00
Loric ANDRE 3a4b958f51 chore: allow using flag or env vars for both log level and file 2026-03-04 21:06:06 +01:00
LoricAndre ffddee2d54
chore: refactor app layout computations to take them out of the hot loop (#996)
* chore: refactor app layout computations to take them out of the hot loop

* chore: use Default for default theme

* fix: recursion loop on default theme
2026-03-04 17:43:13 +01:00
dependabot[bot] 07b40a3281
chore(deps): bump nix from 0.31.1 to 0.31.2 (#995)
* chore(deps): bump nix from 0.31.1 to 0.31.2

Bumps [nix](https://github.com/nix-rust/nix) from 0.31.1 to 0.31.2.
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.31.1...v0.31.2)

---
updated-dependencies:
- dependency-name: nix
  dependency-version: 0.31.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: update libc & other deps now that nix permits it

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Loric ANDRE <loric.andre@pm.me>
2026-03-03 15:25:50 +01:00
Loric ANDRE 9ef09b7da6 release: v3.6.1 2026-03-03 11:54:51 +01:00
Loric ANDRE c5a3310ac4 chore: add bench plot scripts 2026-03-03 11:53:22 +01:00
Loric ANDRE b52dc0cfac chore: switch allocator to mimalloc for ~20% perf in some cases 2026-03-02 20:31:38 +01:00
Loric ANDRE 600d78815e release: v3.6.0 2026-03-02 18:04:50 +01:00
LoricAndre fa003bf7c5
feat(shell): colored history widgets & remove perl completely (#994)
* feat(shell): colored history widgets & remove perl completely

* docs: add variables to top doc

* chore: nitpick
2026-03-02 13:56:36 +00:00
LoricAndre c65274441a
feat: add Arinae algorithm (#990)
* feat: initial work on skim v3

wip

* wip: SW

* chore: refactor SkimV3 to make it more maintainable

* chore: remove SIMD batch scores

* fix: fix Skim V3 tests

* feat: small optimizations

* feat: bigger optimizations

* chore: generate completions & manpage

* chore: remove unused wide dependency

* chore: update deps

* chore: generate completions & manpage

* fix: make sure all subsequences pass in non-typos mode

* chore: trade some performance against more precision with typos

* feat: gain the performance back using unchecked accesses

* chore: remove failing tests

* feat: use banding across whole upper triangle

* chore: remove useless DEAD_COL checks

* feat: make sure we match everything `frizbee` does while enforcing first char

* feat: minor optimizations

* feat: more minor optimizations

* chore: tweak parameters to find a good balance between performance and accuracy

* chore: accept snap

* chore: penalize consecutive typos

* chore: revert consecutive typos penalization as it seems useless in practice

* wip: optimizations

* feat: multiple optimizations

* perf(skim_v3): use 2-row rolling buffer for score-only DP path

When compute_indices=false (fuzzy_match), the full (n+1)×mcols matrix
was allocated and populated even though traceback was never performed.
Introduce score_only_dp() which maintains only two rows at a time,
reducing memory from O(n×m) to O(m) and improving cache utilization
for long choice strings.

* perf(skim_v3): add early termination when DP rows are all-zero

Track consecutive rows where no cell has a positive score. After 2
consecutive dead rows, return None immediately: gap penalties can only
decrease existing scores, so no downstream row can produce a positive
result. Applied to both score_only_dp and full_dp.

* perf(skim_v3): add range_dp for fuzzy_match_range, avoiding full index vec

fuzzy_match_range previously called fuzzy_indices (full traceback collecting
every matched index) just to extract the first and last. Introduce range_dp
which performs the same full-matrix DP but during traceback only records the
begin and end positions, avoiding the Vec allocation and index collection.
Add range_consistent_with_indices test to verify correctness.

* perf(skim_v3): remove redundant is_subsequence scan in exact mode

In non-typo mode, is_subsequence was called before compute_banding, but
compute_banding -> compute_first_match_cols already validates the same
subsequence property (returning None if any pattern char is absent).
Remove the redundant O(m) scan and delete the now-unused is_subsequence
function. Typo mode retains cheap_typo_prefilter as its guard.

* perf(skim_v3): avoid clone in traceback by using mem::take on thread-local buffer

Previously full_dp returned indices via indices_ref.to_vec() which copies
all n index values into a new allocation. Replace with std::mem::take which
moves ownership of the populated Vec out of the thread-local without copying,
trading the reuse-across-calls benefit for zero-copy return per call.

* perf(skim_v3): tighten typo-mode upper band bound in typo_vband_row

Previously the upper column bound in typo mode was always m (the full
choice length), even for early rows where the diagonal sits far from the
right edge. Compute hi = (j + bandwidth).min(m) symmetrically with the
existing lower bound, skipping cells that cannot contribute to a valid
alignment and reducing work for short patterns on long strings.

* perf(skim_v3): use memchr SIMD for first-char search in prefilter and banding

Add memchr as a direct dependency and implement Atom::find_first_in with
a u8-specialization that calls memchr() for case-sensitive search and a
two-call min-of-two approach for case-insensitive. Use this in:
- cheap_typo_prefilter: first-character existence check
- find_first_char: typo-mode banding anchor computation
This replaces scalar byte-by-byte loops with SIMD-vectorized searches for
ASCII inputs, the common case.

* revert(skim_v3): restore m upper bound in typo_vband_row

The tightened hi = (j + bandwidth).min(m) bound incorrectly rejected valid
typo-mode alignments where the optimal path takes many LEFT (gap) steps
past the bandwidth boundary. The snapshot test confirms 5 fewer matches vs
the expected 37. Revert to hi = m; the affine gap penalty alone prevents
poor alignments from winning.

* perf(skim_v3): add ASCII fast path to char::eq_ignore_case

Replace the to_lowercase() iterator comparison with eq_ignore_ascii_case()
for the common case where both chars are ASCII. This avoids creating two
ToLowercase iterators per comparison in the non-ASCII DP path, using a
single bitwise comparison instead.

* perf(skim_v3): replace RefCell with UnsafeCell (TLCell) in thread-locals

ThreadLocal<RefCell<T>> incurs a runtime borrow-check on every access.
Since ThreadLocal already guarantees per-thread isolation and we never
re-enter the same thread-local within a single call stack, the RefCell
check is redundant.

Replace with TLCell<T>, a Send newtype over UnsafeCell<T>, and a tl_get_mut
helper that returns &mut T directly. Document the safety invariant at each
call site. Also remove the now-unused SWMatrix::zero constructor.

* fix(skim_v3): fix precompute_bonuses reserve logic

The previous reserve(cho.len().saturating_sub(buf.len())) computed the
needed additional capacity relative to the current length, which could
be wrong if buf.len() was stale (e.g. after a set_len call on a longer
buffer). Replace with clear() + reserve(cho.len()) for a correct and
clear-intent O(1) reset followed by a single exact reservation.

* guard: return None for pat.len() > MAX_PAT_LEN in exact mode

Patterns longer than MAX_PAT_LEN (16) used the stack-allocated
[usize; MAX_PAT_LEN] banding arrays with out-of-bounds indices,
causing undefined behaviour in the exact (non-typo) DP path.

Add an early return of None in compute_first_match_cols and
compute_last_match_cols so callers gracefully skip overlong patterns
rather than reading past the end of a fixed-size array.  Typo mode
is unaffected: its dummy arrays are never indexed by the pattern
length.

* perf: re-encode Dir::None=0 so CELL_ZERO is all-zero bytes

Previously Dir::None=3 made Cell::new(0,Dir::None) encode as
0x00030000, preventing bulk-zeroing with write_bytes(0).

Re-assign discriminants to None=0, Diag=1, Up=2, Left=3 so that
CELL_ZERO is now all-zero.  Update:
- Dir discriminants in the enum
- Cell::is_diag() (checks tag==1 instead of 0)
- compute_cell branchless arithmetic (base is Left=3, subtract 2 for
  Diag wins, 1 for Up wins; None=0 so no OR needed)
- score_only_dp: replace init loop with write_bytes(0)
- full_dp / range_dp: replace row-0 init loop with write_bytes(0)

* perf: 128-bit ASCII bitset for cheap_typo_prefilter tail scan

Add Atom::count_tail_present with a u8 specialisation that builds a
two-u64 presence bitset from the choice in a single O(m) pass, making
each subsequent pattern-char lookup O(1) instead of O(m).

The char (non-ASCII) path delegates to count_tail_present_ordered, the
same ordered linear scan that was previously inlined in the function.
The change is observationally equivalent: the prefilter remains a
lenient superset of the old check (unordered vs. ordered presence),
and the snapshot test count is unchanged.

* perf: early exit in count_tail_present_ordered when match is impossible

Add a hopeless-state check at the top of each iteration: if matched
plus remaining pattern chars cannot reach min_needed, bail out
immediately rather than completing the full scan.

This prunes the non-ASCII (char) ordered-scan fallback inside
cheap_typo_prefilter when the pattern is long and many chars are
missing from the choice.

* cleanup: remove unused constants SEPARATOR_MASK_LO/HI and FIRST_CHAR_BONUS_MULTIPLIER

All three were suppressed with #[allow(dead_code)] and are not
referenced by any live code.  SEPARATOR_TABLE is the active lookup;
the mask constants were documentation remnants.

* refactor: replace unsafe transmute in Cell::dir() and compute_cell with safe match

Both usages converted a u8 (guaranteed 0..=3) to Dir via transmute.
Replace with an exhaustive match on the 2-bit tag value — no unsafe
required, and the compiler generates the same conditional-move
sequence.

* perf: Atom::is_sep() trait method avoids u8→char→u32 in separator check

Add is_sep() to the Atom trait with a u8 specialisation that indexes
SEPARATOR_TABLE directly with self as usize, skipping the into::<char>
conversion required by the generic default.

Remove the now-unnecessary is_separator free function; callers use
prev.is_sep() instead.

* refactor: precompute_bonuses rewritten as safe iterator chain

Replace the unsafe raw-pointer write loop with a safe iterator that
starts with START_OF_STRING_BONUS and maps windows-of-2 to the
separator/camelCase bonus formula.  buf.extend() dispatches through
ExactSizeIterator, so no extra allocation occurs.

The safe form exposes the element-independent structure to the
compiler, enabling auto-vectorisation on release builds.

* refactor: extract match_slices_range; simplify run_range

Add match_slices_range<C: Atom> that mirrors match_slices but calls
range_dp instead of dispatch_dp.  run_range now delegates the ASCII
path to match_slices_range and keeps only the non-ASCII char-buf
setup inline, eliminating the duplicated prefilter + bonus +
range_dp block.

* mem: SWMatrix::resize shrinks when buffer is 4× over-allocated

After a one-off large input, the full-DP matrix buffer could hold
significantly more memory than typical inputs require.  Add a
shrink-or-cap heuristic: if the current capacity exceeds 4× the
needed size, truncate and shrink_to(2×needed) to release excess
memory without thrashing on stable-sized inputs.

* Revert "mem: SWMatrix::resize shrinks when buffer is 4× over-allocated"

This reverts commit 9c8571ebe8.

* Revert "refactor: replace unsafe transmute in Cell::dir() and compute_cell with safe match"

This reverts commit 8805fa14ce.

* Revert "perf: Atom::is_sep() trait method avoids u8→char→u32 in separator check"

This reverts commit 175f26af81.

* Revert "perf: early exit in count_tail_present_ordered when match is impossible"

This reverts commit 29721558f0.

* Revert "perf: 128-bit ASCII bitset for cheap_typo_prefilter tail scan"

This reverts commit d79947fcb5.

* Revert "refactor: extract match_slices_range; simplify run_range"

This reverts commit 0fb7f05513.

* Revert "perf(skim_v3): replace RefCell with UnsafeCell (TLCell) in thread-locals"

This reverts commit 0806683251.

* Revert "perf(skim_v3): add ASCII fast path to char::eq_ignore_case"

This reverts commit 069710ad7c.

* Revert "revert(skim_v3): restore m upper bound in typo_vband_row"

This reverts commit 90ffc46633.

* Revert "perf(skim_v3): tighten typo-mode upper band bound in typo_vband_row"

This reverts commit f38ca3a10d.

* Revert "perf(skim_v3): avoid clone in traceback by using mem::take on thread-local buffer"

This reverts commit ffa9a21167.

* Revert "perf(skim_v3): add early termination when DP rows are all-zero"

This reverts commit 073195be58.

* Revert "perf(skim_v3): use 2-row rolling buffer for score-only DP path"

This reverts commit 3acacaad74.

* fix: reverse only order of frizbee indices

* chore: rename & refactor into multiple files

* chore: optimizations to the main flow

* fix: correct banding in non-typo path

* chore: generate completions & manpage

* docs: add algorithms section to the README [skip ci]

* fix(ari): correctly bound vband low

* chore(ari): specific pre-separator bonuses

* fix(ari): boost consec a bit more to beat start/sep

* chore: generate completions & manpage

* feat: run matcher over chunks

* chore: adjust penalties to keep typos under subsequences

* chore: accept snapshot

* fix: replace greedy ordered prefilter with looser unordered

* chore: finish up rename

* chore: review

---------

Co-authored-by: Skim bot <skim-bot@skim-rs.github.io>
2026-03-01 18:50:28 +01:00
faukah b47bda8902
flake.nix: drop flake-utils, add formatter (#992) 2026-02-25 18:29:40 +01:00