Update search implementation comments

This commit is contained in:
Marshall Lochbaum 2023-11-09 15:18:28 -05:00
parent 2c625127d5
commit 7b79dfc94e

View File

@ -1,23 +1,34 @@
// Dyadic search functions: Member Of (∊), Index of (⊐), Progressive Index of (⊒) // Dyadic search functions: Member Of (∊), Index of (⊐), Progressive Index of (⊒)
// 𝕨⊐unit or unit∊𝕩: scalar loop with early-exit // 𝕨⊐unit or unit∊𝕩: SIMD shortcutting search
// SHOULD use simd // 𝕨⊒𝕩 where 1≥≠𝕩: defer to 𝕨⊐𝕩
// SHOULD unify implementations // High-rank inputs:
// 𝕩⊒unit or 𝕨⊒𝕩 where 1≥≠𝕩: defer to 𝕨⊐𝕩 // Convert to a typed numeric list if cells are ≤62 bits
// COULD have hashing for equal-type >64 bit cells, to skip squeezing
// Both arguments with rank≥1: // COULD try squeezing ahead-of-time to skip it in bqn_hash
// High-rank inputs: // SHOULD have fast path when cell sizes don't match
// Convert to a (lower-rank) typed integer array if cells are ≤62 bits // One input empty: fast not-found
// COULD have special hashing for equal type >64 bit cells, skipping squeezing // Character elements:
// COULD try conditionally squeezing ahead-of-time, and not squeezing in bqn_hash // Character versus number array is fast not-found for ∊ and ⊐
// p⊐n & n∊p with short p & long n: n⊸=¨ p // SHOULD have fast character-number path for ⊒
// bitarr⊐𝕩: more special arithmetic // Reinterpret as integer elements
// SHOULD have impls for long p & short n // COULD try p=⌜n when all arguments are short (may not be faster?)
// ≤16-bit elements: lookup tables // p⊐n & n∊p with short n: p⊸⊐¨n
// Character elements: reinterpret as integer elements // p⊐n & n∊p with boolean p: based on ⊑p and p⊐¬⊑p
// Otherwise, generic hashtable // p⊐n & n∊p with short p:
// SHOULD handle up to 64 bit cells via proper typed hash tables // AVX2 binary search when applicable
// SHOULD have fast path when cell sizes or element types doesn't match // n⊸=¨p otherwise
// ≤16-bit elements: lookup tables
// 8-bit ∊ and ⊐: SSSE3 table
// SHOULD make 8-bit NEON table
// 32- or 64-bit elements: hash tables
// Store hash in table and not element; Robin Hood ordering; resizing
// Reverse hash if searched-for is shorter
// Shortcutting for reverse hashes and non-reversed ⊒
// SIMD lookup for 32-bit ∊ if chain length is small enough
// SHOULD partition if hash table size gets large
// SHOULD handle unequal search types better
// Otherwise, generic hashtable
#include "../core.h" #include "../core.h"
#include "../utils/hash.h" #include "../utils/hash.h"