u/sdogruyol

Next version of gcry is faster than Boehm GC. And it uses less RAM.

Next version of gcry is faster than Boehm GC. And it uses less RAM.

On a production Kemal app (Açık Türkiye):

- 103% Boehm throughput
- 8% less memory
- 100% Crystal
- No C code

Crystal can have its own GC. We're building it

https://github.com/sdogruyol/gcry

https://preview.redd.it/9swtwns4bchh1.png?width=900&format=png&auto=webp&s=ca2216e5d7c22b74f1c4139292c45c3130339870

reddit.com
u/sdogruyol — 17 days ago
▲ 130 r/crystal_programming+1 crossposts

I can't find a job, so I'm building Crystal's future instead. Here's what I'm working on and why I need your help

I can't find a job, so I'm building Crystal's future instead. Here's what I'm working on and why I need your help.


Hi, I'm Serdar (sdogruyol). I created Kemal, I'm a Crystal Core Team member, and I've been building Crystal tools since 2015.

I can't find a job right now. So instead of waiting around, I'm spending every day on Crystal open source. No safety net, no backup plan, just Crystal.


What I'm working on

gcry - a %100 Crystal native garbage collector for Crystal. Currently at ~89% of Boehm GC's throughput with ~0.95x RSS. My hope is that one day it becomes the default GC for Crystal. That's the dream.

Kemal - 3.8k+ stars, 5M+ downloads. I've been maintaining it since 2015. The framework, session management, CSRF, auth, caching, the whole ecosystem. I'm not going anywhere.

Crystal Weekly - a newsletter keeping the community updated.

Crystal Community - discover Crystal developers around the world and check Crystal Stats.

Free books - Crystal for Rubyists, Kemal El Kitabı, Crystal El Kitabı. All free.


Why I'm here

I set up a GitHub Sponsors page. My goal is $1,000/month so I can keep doing this full time. If Kemal or any of my projects has helped you, or if you believe in Crystal's future, please consider sponsoring. Every dollar counts.

Even $5/month helps. Here's what you get:

Tier Price Perk
☕ Coffee $5 Sponsor badge
⚡ Kebab $10 Badge + personal thanks
🛠️ Backer $20 Name in Kemal README
🏆 Champion $50 Logo + shoutout
🏢 Corporate $100 Logo + Twitter shoutout

Thanks for reading. Let's build Crystal's future together. 💎

👉 github.com/sponsors/sdogruyol

u/sdogruyol — 18 days ago

gcry: a garbage collector written in pure Crystal

I just released 0.14.0 of gcry. It's a conservative mark sweep GC written entirely in Crystal, shipped as a shard. No C code, no compiler patches, no fork. You just add require "gcry" and build with -Dgc_none.


Performance

Same host, median of 3, wrk -c 100 -d 30:

Workload gcry vs Boehm Post-GC RSS
Kemal /json (Linux) ~89% throughput 0.79x Boehm
Kemal root (Linux) ~89% throughput 0.78x Boehm
Kemal /json (macOS) ~84% throughput 0.93x Boehm
Kemal root (macOS) ~93% throughput 1.06x Boehm

21% less memory than Boehm on Linux Kemal. Same throughput.


What makes gcry different

It's a conservative, non-moving, stop-the-world collector. Same family as Boehm, so it works with Crystal's existing ABI. But it's written in Crystal, which means:

  • You can read it. The whole collector is about 9,000 lines of Crystal across 32 files. No C macros, no opaque foreign library.
  • You can debug it. Set a breakpoint anywhere. Crystal's debugger works on it.
  • You can change it. Want to experiment with a different marking strategy? Edit a .cr file and rebuild.

Architecture: mmap-backed size classes, fiber stack roots, conservative mark with layout precise opt-in, deferred madvise, and platform specific STW (Linux signals, Mach thread_suspend on macOS).


What's new in 0.14.0

This release is all about quality infrastructure:

  • Debug invariant checker (GCRY_DEBUG_INVARIANTS=1). Validates live_objects counter, freelist consistency, chunk index integrity, block overlap detection. At runtime, on every malloc/free/collect.
  • AddressSanitizer and Valgrind on every PR in CI.
  • Coverage reports via kcov on every PR.
  • Deterministic replay fuzzing with --seed and --replay.
  • 24 hour soak tests, thread storm tests, OOM tests, property based heap invariant tests.
  • Heap dump (Gcry.dump_heap) streams live objects as NDJSON for leak hunting.
  • Trace (GCRY_TRACE=1) traces every collect, malloc, and free.

How to try it

# shard.yml
dependencies:
  gcry:
    github: sdogruyol/gcry
{% if flag?(:gc_none) %}
  require "gcry"
{% end %}

puts "Hello from gcry!"
crystal build -Dgc_none app.cr -o app

No special malloc API. No compiler fork. String, Array, Hash, everything works as usual.


Limitations

gcry is a shard and I'm pushing it as far as I can. But there are things you can't do from a shard. True precise stack scanning, write barriers, and concurrent collection need compiler support. At some point that line has to be crossed. But for now, the shard approach gets you surprisingly far: Kemal class HTTP at near Boehm perf, layout precise heap scanning, fiber stack scrubbing, and full observability. All without touching the compiler.


Github

https://github.com/sdogruyol/gcry

u/sdogruyol — 23 days ago

cryload 5.0.0 is released

cryload is a powerful, fast, and practical HTTP benchmarking tool for stress testing APIs and web services.

Built with Crystal for high performance and low overhead.

What's new in 5.0.0:

  • Honest percentiles — transport errors (timeouts, refused connections) no longer pollute latency stats, and the new HDR-style histogram keeps p50–p999 accurate within 1% from microseconds to minutes
  • --disable-keepalive — measure real connection setup cost, like hey
  • --body-stdin — pipe request bodies straight in: jq -c '.payload' fix.json | cryload ... --body-stdin
  • Big perf wins — up to 13x faster in multi-URL/cache-busting modes thanks to per-origin connection pooling
github.com
u/sdogruyol — 2 months ago
▲ 35 r/crystal_programming+1 crossposts

Huge Milestone: There are now over 10,000 Crystal projects!

I was just checking the data over at the Crystal Community Stats page and realized we've officially crossed a massive milestone: there are now more than 10,000 Crystal repositories!

Seeing how far the ecosystem has come is just incredible. From the early days of building Kemal and piecing together the first shards, to seeing the language mature and the core team push boundaries, the community's dedication to performance, concurrency, and developer happiness has never been stronger.

This isn't just a number; it’s proof that the "Ruby-like syntax, C-like speed" philosophy is steadily growing its footprint. We're seeing more high-performance backends, blazingly fast CLI tools, and minimalist web frameworks being built every single day.

A huge shoutout to everyone contributing to the compiler, writing and maintaining shards, or even just spinning up their first HTTP server to try the language out.

To celebrate, let’s do a quick roll call: What are some of your favorite Crystal projects or shards right now? Or what are you currently building? Let’s highlight the awesome work happening in the ecosystem! 👇

https://preview.redd.it/964zvue61u3h1.png?width=1202&format=png&auto=webp&s=aee4e8704a4b51ac388a42bec2708067f2798b60

reddit.com
u/sdogruyol — 3 months ago