gdt-cpus

Pin it. Prioritize it. Dominate it.

Your CPU has P-cores, E-cores, caches galore. The OS? It's trying its best. Bless its heart. gdt-cpus gives YOU the reins.

Side effects may include actual performance gains and a sudden urge to optimize everything.

gdt-cpus was engineered by a tiny studio with very big voxel dreams.

Obsessed with world-building tech, simulation engines, and questionable life choices.

Wild Pixel Games Logo - Light Theme Wild Pixel Games Logo - Dark Theme

The CPU Mess (Why Your OS Needs a Babysitter)

Modern CPUs? They're not simple. You've got Performance-cores for the heavy lifting, Efficiency-cores for the chores, and a cache hierarchy that'd make a librarian weep. The OS scheduler is supposed to manage this circus, but for high-performance apps like games? It's often just guessing, leaving your critical threads on E-cores or bouncing them around like a caffeinated squirrel. Result? Lag, stutter, and wasted potential.

OS Scheduler's Top Blunders:

  • Core Confusion: "Is this P-core important? Nah, let's put the background logger on it."
  • Thread Ping-Pong: Your render thread visiting more cores than a tourist. Cache coherence? What's that?
  • Priority "Suggestions": Your "critical" thread treated like a mild inconvenience.

gdt-cpus: The CPU Whisperer Your Code Deserves

Stop begging the OS. gdt-cpus hands you the keys to the kingdom. We're talking deep CPU intel and surgical thread control, all wrapped in a Rust-idiomatic API that doesn't suck.

Full Topology

Vendor, model, sockets, cores, caches. Know your hardware.

Hybrid Genius

P-cores, E-cores. We see them. We use them. Properly.

Thread Pinning

Tell that critical thread to STAY. PUT. (Platform permitting, Apple.)

Real Priorities

From "meh, background" to "TIME CRITICAL, GET OUT OF THE WAY!"

C FFI Ready

Got legacy C/C++? gdt-cpus-sys lets them taste Rust power. No excuses.

Rust Power

Safety and performance you know and love, now for your CPU.

Part of the GDT Ecosystem

AAA-grade open-source, forged in production fire.

Part of the Game Developer’s Toolkit — libraries built with years of experience from top-tier studios, now yours to use freely.

gdt-cpus You are here

Pin it. Prioritize it. Dominate it. Your CPU has P-cores, E-cores, caches galore. The OS? It's trying its best. Bless its heart. gdt-cpus gives YOU the reins.

  • Full Topology: Vendor, model, sockets, cores, caches.
  • Hybrid Genius: P-cores, E-cores. We see them. We use them.
  • Thread Pinning & Real Priorities: Surgical thread control.

"My CPU used to cry itself to sleep. Then I found gdt-cpus." – A Very Smart Developer

Explore gdt-cpus

gdt-jobs

Jobs That Don't Mess Around. High-performance task execution built for games and sims needing serious parallelism. Born out of necessity, open-sourced out of spite love.

  • 7 Priority Levels: Because "urgent" and "REALLY URGENT" are different.
  • P/E Core Aware Scheduling: Squeezes hybrid CPUs for all they're worth.
  • Flexible Task Graphs: Define explicit task graphs, not chaos.

"If your thread pool doesn't scare your CPU a little, is it even trying?"

Learn about gdt-jobs

gdt-memory (WIP)

Because your RAM deserves a tyrant, not a suggestion. Composable allocators for when std::alloc just doesn’t cut it. Fine-grained control over memory — from stack frames to custom heaps — because performance is non-negotiable.

  • Allocator Trait: Your rules, your memory.
  • Leaf Allocators: Stack, Frame, Heap, Bitmap, FreeList.
  • Compositors: Segregator, Fallback. Build your own hierarchy.
  • Alignment & Control: Perfect for SIMD.
  • Leak Detection & Profiling: Hunt down memory gremlins.

"To malloc is human, to gdt-memory, divine. (And much, much faster.)"

Proof is in the Pudding (Lower Latency, Higher Thrashput™)

Words are wind. gdt-cpus enables real, measurable wins. When your task system (like gdt-jobs) or your app knows what it's running on and can tell threads what to do, good things happen.

Audio Latency: SILENCE THE JITTER!

p99 Jitter (µs). Lower is music to your ears. TC = TimeCritical.

Frame Jitter: BUTTERY SMOOTH!

p99 Jitter (µs). Lower means less stutter. H = Highest.

Parallel Tasks: NO MORE TAIL LAG!

p99 Latency (µs) on macOS M3 Max. P/E strategy wins.

Streaming Pipeline: FASTER ASSETS!

p50 Latency (µs). Prioritization matters.

These aren't just numbers, they're your app running better. You're welcome.

Under The Hood: How We Tame The Silicon Beast

gdt-cpus isn't just calling num_cpus::get(). That's for amateurs. We dive deep into OS-specific APIs so you don't have to:

Windows

GetLogicalProcessorInformationEx, Registry, SetThreadAffinityMask

Linux

sysfs, /proc/cpuinfo, cpuid, sched_setaffinity, setpriority

macOS

sysctl, cpuid (x86), QoS, thread_policy_set

All this pain, abstracted away into one beautiful, cross-platform Rust API. We do the dirty work. You reap the rewards.

"Abstraction without insight is just hiding the problem. gdt-cpus gives you both."

Hybrid CPU Dominance: P-Cores & E-Cores on a Leash

Those P-cores and E-cores? They're not just suggestions. gdt-cpus tells you exactly what you've got, so you (or your job system) can:

P-Cores (Performance)

Unleash the beasts for your critical, latency-sensitive work. Pin 'em if you got 'em (and if your OS isn't Apple).

E-Cores (Efficiency)

Perfect for background tasks, parallel number crunching that can wait, or just saving your laptop's battery. Offload wisely.

gdt-cpus gives you the intel. Using it to make your app scream (or sip power) is up to you.

gdt-cpus vs. The "Alternatives" (Bless Their Hearts)

Sure, there are other ways to poke at your CPU. If you like basic, or platform-locked, or just... less.

Capability gdt-cpus (The Pro) num_cpus (The Intern) raw-cpuid (The x86 Nerd) OS APIs (The DIY Nightmare)
Core Counts 👑 👍 🤷 😬
Full Topology (Cache, Sockets) 👑 🔬 (x86) 🤯
P/E Core Detection 👑 🧩
Thread Affinity 👑 🧩
Thread Priority 👑 🧩
Cross-Platform Ease 👑 👍 limited ❌❌❌

Who Rules the CPU?

Higher score is better. Max 10.

We ❤️ num_cpus – full respect!

Our brains just speak in sarcasm & memes 🤷‍♂️

(num_cpus paved the way for CPU introspection in Rust – gdt-cpus just straps a rocket to it. 🚀)

Choose wisely. Or just choose gdt-cpus and be done with it.

The SWOT Analysis (Because We're "Strategic")

💪 Strengths (Obvious Stuff)

  • Deep CPU insights, cross-platform.
  • P/E core aware. Your hybrid CPU will love you.
  • Thread pinning & priority control that *works*.
  • Foundation for god-tier task systems (hi, gdt-jobs!).
  • C FFI via gdt-cpus-sys? Check. Your C++ will thank you.

📉 Weaknesses (If We *Must*)

  • Not magic. You still gotta write good code on top.
  • Apple Silicon affinity? Apple says "lol no". We report that accurately.
  • Might be overkill if all you need is num_cpus::get(). (But why settle?)

🚀 Opportunities (World Domination Plans)

  • More NUMA smarts for server beasts.
  • Even *more* detailed cache info. Because why not.
  • Your favorite engine using gdt-cpus under the hood.

⚠️ Threats (The Competition... Kinda)

  • OS schedulers *might* get smarter. Someday. Maybe.
  • Someone writing an even *more* arrogant README. Unlikely.

Versioning – CalVer, Deal With It

Wait, CalVer for a lib? Ya Idjits or something?

(Bobby Singer voice, obviously.)

Yep, we timestamp our releases instead of counting up semantic digits. Why? Because we're just built different. And because:

CalVer Perk Why You Care
Instant age check 25.5.0 → May 2025. No need to diff tags to see if a crate is fossilized or fresh off the compiler.
Honesty about breakage New month? Could be a breaking change. You’ll know from the number *and* from a Migration Guide 25.425.5 in the repo. We're not shy.
Works fine with Cargo cargo add gdt-cpus@^25.5 still pins the May 2025 API line; you won’t auto-upgrade to 26.1 unless you explicitly ask for it. Cargo gets it.
Less bike-shedding We’d rather spend time tuning work-steal loops and optimizing P/E core scheduling than debating whether the last commit was “minor” or “patch”. Priorities, people.

TL;DR:

Each year/month is an API epoch. If we break you, the migration doc shows the fix; if we don’t, cargo update is painless.
And if we mess up, the date tells you exactly when to roast us in Issues. 😎

(We’re not idjits – just impatient.)

How Can I Contribute?

Find something that’s missing, broken, or just less performant than your standards require.
Open an issue. Bonus points if you make a PR. A 🍪 if benchmarks go brrrrr.

But wait, where is the CODE_OF_CONDUCT?
Code of what? Quoting a famous internet meme:

“Apologies for the very personal question, but were you homeschooled by a pigeon?”

We're all civilised here. Just don't be an asshole and we're good. 🤞🏻

And hey, mad props to the entire Rust community. Y'all make low-level coding sexy again. This stuff is built with love, for the love of the game (and performant Rust).