frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: C discrete event SIM w stackful coroutines runs 45x faster than SimPy

https://github.com/ambonvik/cimba
5•ambonvik•1h ago
Hi all,

I have built Cimba, a multithreaded discrete event simulation library in C.

Cimba uses POSIX pthread multithreading for parallel execution of multiple simulation trials, while coroutines provide concurrency inside each simulated trial universe. The simulated processes are based on asymmetric stackful coroutines with the context switching hand-coded in assembly.

The stackful coroutines make it natural to express agentic behavior by conceptually placing oneself "inside" that process and describing what it does. A process can run in an infinite loop or just act as a one-shot customer passing through the system, yielding and resuming execution from any level of its call stack, acting both as an active agent and a passive object as needed. This is inspired by my own experience programming in Simula67, many moons ago, where I found the coroutines more important than the deservedly famous object-orientation.

Cimba turned out to run really fast. In a simple benchmark, 100 trials of an M/M/1 queue run for one million time units each, it ran 45 times faster than an equivalent model built in SimPy + Python multiprocessing. The running time was reduced by 97.8 % vs the SimPy model. Cimba even processed more simulated events per second on a single CPU core than SimPy could do on all 64 cores.

The speed is not only due to the efficient coroutines. Other parts are also designed for speed, such as a hash-heap event queue (binary heap plus Fibonacci hash map), fast random number generators and distributions, memory pools for frequently used object types, and so on.

The initial implementation supports the AMD64/x86-64 architecture for Linux and Windows. I plan to target Apple Silicon next, then probably ARM.

I believe this may interest the HN community. I would appreciate your views on both the API and the code. Any thoughts on future target architectures to consider?

Docs: https://cimba.readthedocs.io/en/latest/

Repo: https://github.com/ambonvik/cimba

Comments

quibono•14m ago
I don't know enough about event simulation to talk API design in depth but I find the stackful coroutine approach super interesting so I'll be taking a look at the code later!

Do you plan on accepting contributions or do you see the repo as being a read-only source?

ambonvik•8m ago
I would be happy accepting contributions, especially for porting to additional architectures. I think the dependency is relatively well encapsulated (see src/port), but code for additional architectures needs to be well tested on the actual platform, and there are limits to how much hardware fits on my desk.

Using Data Version Control (DVC)

https://amirghofran.com/learning/dvc/
1•yamirghofran•10s ago•0 comments

Benchmarking STT providers on real calls (Deepgram 15.9% vs. OpenAI 39.8% WER)

https://twitter.com/pstrav/status/2018416957003866564
1•pstrav•51s ago•1 comments

Show HN: Whilst – A Space for Writing on the Web

https://whilst.app
1•JonnyB-Ire•1m ago•0 comments

I made a real PS1 game in 1.5 months (Making of Yume Nikki PS) [video]

https://www.youtube.com/watch?v=dsA2sQ-rThU
1•davikr•1m ago•0 comments

Ask HN: What are you working on? (February 2026)

1•iryndin•3m ago•0 comments

Jeffrey Snover: "Welcome to the Room"

https://www.jsnover.com/blog/2026/02/01/welcome-to-the-room/
1•kaonwarb•4m ago•0 comments

How I Experience the Web Today

https://how-i-experience-web-today.com/
1•hobzcalvin•4m ago•0 comments

Memory Price Outlook for 1Q26 Sharply Upgraded

https://www.trendforce.com/presscenter/news/20260202-12911.html
1•layer8•4m ago•0 comments

Show HN: I built Resumelyai "blind spots" in resumes; 34 users landed interviews

https://myresumelyai.com/
1•simullab•5m ago•0 comments

I made 20 GDPR deletion requests. 12 were ignored

https://nikolak.com/gdpr-failure/
2•nikola-k•5m ago•0 comments

Show HN: CleanCloud: Read-only cloud hygiene CLI – Feedback wanted

1•sureshcsdp•6m ago•0 comments

Show HN: Shotframe – Free mockup generator with saveable style presets

https://www.shotframe.space/
1•varunkv•6m ago•0 comments

Anthropic is about to drop Sonnet 5 during Super Bowl week

https://www.testingcatalog.com/anthropic-is-about-to-drop-sonnet-5-during-super-bowl-week/
2•gmays•7m ago•0 comments

Update on Irish GDPR Decision about TikToks Transfers of EEA User Data to China

https://www.tiktok.com/legal/page/global/update-on-irish-gdpr-decision/en
1•Topfi•8m ago•0 comments

KORA: A public benchmark for AI Child Safety across frontier models

https://korabench.ai/
2•cissou•8m ago•0 comments

The Green River flows 'uphill.' Geologists think they know why

https://www.popsci.com/environment/why-green-river-flows-uphill/
1•Brajeshwar•8m ago•0 comments

Enormous 'mega-blob' under Hawaii is solid rock and iron

https://www.livescience.com/planet-earth/geology/enormous-mega-blob-under-hawaii-is-solid-rock-an...
1•Brajeshwar•9m ago•0 comments

Scientists discover molecule in space that hints at origin of life

https://www.cnn.com/2026/01/30/science/sulfur-molecule-space-discovery
1•Brajeshwar•9m ago•0 comments

Serverless SQL Databases for Devs (2026 Comparison)

https://www.devtoolsacademy.com/blog/serverless-sql-databases/
1•TheAnkurTyagi•9m ago•0 comments

Whilst others drop models, MS drop Opus and Codex pricing to $0

https://github.com/microsoft/vscode/issues/292452
1•FlowStateHax•10m ago•1 comments

Upgrading a 10 Year Old Linux Workstation Against the Internets Advice

https://justinribeiro.com/chronicle/2026/02/02/upgrading-a-10-year-old-linux-workstation-against-...
1•speckx•10m ago•0 comments

I ran 40km and knit a hat for my 40th birthday

https://catswhisker.xyz/log/2024/3/4/i_ran_40km_and_knit_a_hat_for_my_40th_birthday/
1•cristoperb•11m ago•0 comments

Defending the Apple Neural Engine (ANE)

https://dennisforbes.ca/blog/microblog/2026/02/apple-neural-engine-and-you/
2•llm_nerd•11m ago•0 comments

The AI industry doesn't take "no" for an answer

https://manualdousuario.net/en/ai-industry-doesnt-take-no-for-an-answer/
1•rpgbr•12m ago•0 comments

The Cost of Tax Regressivity at the Top

https://www.cambridge.org/core/journals/british-journal-of-political-science/article/hidden-cost-...
1•PaulHoule•12m ago•0 comments

Sonnet 5 (Full Text)

https://www.folger.edu/explore/shakespeares-works/shakespeares-sonnets/read/5/
7•vapemaster•14m ago•1 comments

StopICE hacked to send alarming text messages admins accuse CBP agent sabotage

https://www.theregister.com/2026/02/02/stopice_alerts_hacked/
7•Bender•15m ago•0 comments

Shopify checkout changes broke purchase tracking for many stores

1•ty-bridge•15m ago•0 comments

OpenClaw

1•som_poison•15m ago•0 comments

Screenshot Story Flows: The 2026 Framework for High Conversions

https://appscreenshotstudio.com/blog/screenshot-story-flows-the-2026-framework-for-high-conversio
1•Welten01•17m ago•0 comments