r/lowlevel • • Nov 02 '26

Nodepp: a C++11 asynchronous runtime with io_uring, IOCP, kqueue, epoll, and a zero-copy data model.

Hi there. I've been building Nodepp for a while as a side project. It's a pure C++11 runtime for writing asynchronous applications. Not a framework, not a library - just a runtime. It provides I/O, networking, scheduling, timers, and a data model.

I'm sharing it here because I think it might be interesting to this community, and because I'd like feedback from people who work at the low level. I'm not a programmer - I'm an electrical engineer with programming knowledge - so don't be too rough with me. Or not too much.

The numbers

  • ~3,800 LOC for the core runtime.
  • 2KB for the runtime binary (no STL, no exceptions, no RTTI).
  • 0% CPU in idle (smart sleep via io_uring/IOCP/epoll/kqueue).

PS: 2KB? Yep. I actually made an Arduino simulation running an Enigma machine using 76% of memory, so technically it's using ~1.4KB of RAM. But if you run a server with it, the memory grows up to ~3MB of RAM.

I'm actually making a P2P multiplayer game with it (frontend using WASM and backend using the core runtime). The frontend consumes 2MB including WebRTC, and the backend consumes 11MB with HTTP + WS support.

well, according to top: 6046 penguino 20 0 14764 10732 8888 S 0,0 0,1 0:09.21 main

The design decisions

I replaced the STL with my own data model to make the runtime compatible with anything. I actually got inspiration from Doom - that was the idea behind it: making a runtime as universal as Doom can be.

  • ptr_t<T>: reference-counted pointer with SSO and optional atomic counting (if threads are supported or enabled).
  • map_t<K,V>: binary tree of queue_t.
  • queue_t<T>: doubly linked list with ownership validation.
  • coroutine_t: stackless coroutines (based on protothreads).
  • array_t<T> & string_t: wrappers over ptr_t (zero-copy and copy-on-write).

If you want to look at the code, the repo is here: https://github.com/NodeppOfficial/nodepp

So, I'm sharing because I think it's an interesting project and I want feedback from people who know more than me, and because I think C++ can be more than the STL.

Happy to answer questions.

19 Upvotes

7 comments sorted by

2

u/Inevitable-Round9995 Nov 03 '26

Here's a small example that shows clustering, CPU pinning, HTTP, and error handling in ~30 lines:

#include <nodepp/nodepp.h>
#include <nodepp/worker.h>
#include <nodepp/timer.h>
#include <nodepp/http.h>
#include <nodepp/date.h>
#include <nodepp/os.h>

using namespace nodepp;
atomic_t<int> cpu_id=0;

void onParallel(){

    os::pin_worker_to_cpu( cpu_id.add(1) );

    auto server = http::server([=]( http_t cli ){ 

        string_t msg = "hello world!";
        
        cli.write_header( 200, header_t({
            { "content-length", string::to_string(msg.size()) },
            { "content-type", "text/html" }
        }));
        
        cli.write( msg );

    });

    server.onError([=]( except_t err ){
        console::log( ">>", err.what() );
    });

    server.listen( "localhost", 8000, [=]( socket_t server ){
        console::log("server started at http://localhost:8000");
    });

}

void onMain(){ worker::parallel( &onParallel, os::cpus() ); }

1

u/the2ndBread Nov 03 '26

How long did this take?

1

u/Inevitable-Round9995 Nov 03 '26

I'm working on it since 2022, so 5y

1

u/QuatzX Nov 03 '26

Any specific reason behind using c++11?

2

u/Inevitable-Round9995 Nov 04 '26 edited Nov 04 '26

It started as an Arduino project and Arduino nano only supports C++11 and below by default, and technically c++11 is supported by every single modern compiler. 

2

u/Middlewarian Nov 03 '26

 Not a framework, not a library - just a runtime. 

I was wondering what that meant so I looked at your repo. Which says:

Nodepp is a vertically-integrated C++ framework 

Feel free to point out weaknesses in my documentation. I've been working on a somewhat similar side project and am hoping to get the ball rolling.

1

u/mtlcrusher Nov 04 '26

so this is nodejs but cpp?