GOOGLE HIGHWAY SIMD · DYNAMIC MULTI-TARGET DISPATCH

Vectorized QuickSort.
Up to 7.1x Faster than V8.

Zero-copy SIMD sorting for TypedArrays and NumPy arrays across Apple Silicon NEON, AVX2, AVX-512, and SVE. Saturating vector lanes at over 600 Million elements/second.

npm install vector-qsort
pip install vector-qsort
Evaluation Presets

Vector Config

Zero-Copy Buffer
Buffer Size (N elements) 100,000
Sorting Order Ascending
Hardware Vector Lanes ARM NEON (128-bit)
Lane 0 [32b]
Lane 1 [32b]
Lane 2 [32b]
Lane 3 [32b]

Telemetry & Speedup

Calibrated against host CPU
7.12x SPEEDUP
SIMD VECTORIZED
vector-qsort (SIMD) 0.728 ms
V8 Native (.sort) 5.184 ms
Throughput 137.4 M/s
Raw Input Distribution In-Place SIMD Partitioned
vector-qsort (Highway SIMD) 0.73 ms (100% relative)
V8 Native TypedArray.sort() 5.18 ms (712% time)
Telemetry Dump Zero GC Overhead

      

Microarchitecture & Highway Core

Why Vector Quicksort consistently outperforms scalar comparison pipelines.

01 / DYNAMIC DISPATCH

Single Portable Binary

Highway compiles vectorized sorting kernels for NEON, AVX2, AVX-512, and SVE. At runtime, CPUID automatically activates the widest available vector registers with zero overhead.

02 / BRANCHLESS NETWORKS

Sorting Networks Base Case

Small slices ($N \le 64$) are sorted entirely within vector registers using Bose-Nelson / Batcher sorting networks. No CPU branch mispredictions and no pipeline flushes.

03 / PARALLEL PARTITIONING

Hardware Vector Compression

Partitioning checks 8 to 16 keys simultaneously, generates vector bitmasks, and uses hardware `CompressStore` (or NEON table lookups) to pack elements without scalar branching.

04 / ZERO-COPY ACCESS

Direct C++ Pointer Extraction

Node-API extracts raw pointers via `napi_get_typedarray_info`, and Python accesses C-contiguous memory via DLPack (`nb::ndarray`). Data is sorted directly in place without copies.

Zero Ceremony Integration

Functional, code-first design in Hemanth HM's signature module style.

import vsort from 'vector-qsort';

const f32 = new Float32Array([3.14, -1.5, 42.0, 0, -100.5, 2.71]);

// In-place SIMD sort
vsort(f32);
// Float32Array [-100.5, -1.5, 0, 2.71, 3.14, 42]

// Descending
vsort(f32, { desc: true });

// Non-mutating copy
const sorted = vsort.sorted(f32);

// Off-thread sorting on libuv worker pool (zero event loop lag)
await vsort.async(new Float32Array(10_000_000));
import numpy as np
import vector_qsort

data = np.array([3.14, -1.5, 42.0, 0.0, -100.5, 2.71], dtype=np.float32)

# In-place SIMD sort (zero memory copy)
vector_qsort.sort(data)

# Descending order
vector_qsort.sort(data, desc=True)

# Non-mutating copy
sorted_data = vector_qsort.sorted(data)
Copied to clipboard