Skip to content

Commit b28263a

Browse files
committed
📌 Nodepp | Stable Version | V1.4.0 📌
1 parent 322448c commit b28263a

56 files changed

Lines changed: 1811 additions & 1276 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
[![Build Status](https://github.com/NodeppOfficial/nodepp/actions/workflows/main.yml/badge.svg)](https://github.com/NodeppOfficial/nodepp/actions)
66
[![Valgrind Memory Test](https://img.shields.io/badge/memory-zero_leaks-green)](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/valgrind_benchmark/readme.md)
77

8+
Nodepp is the end of excuses. For too long, developers have settled for **fragmented glue-ware** or managed runtimes that treat hardware resources like garbage. Nodepp is a vertically-integrated C++ framework that proves you don't need a massive Virtual Machine or a bloated Garbage Collector to write high-level async code.
89

9-
**Nodepp** is a vertically integrated C++ runtime engineered to eliminate the Hardware Tax in cloud and edge computing. It bridges the gap between high-level developer velocity and low-level mechanical sympathy.
10+
While others are busy **masturbating the CPU** — burning millions of cycles on garbage collection, context switching, and runtime management — Nodepp focuses on Pure Execution. It provides a unified world architecture where every module shares the same high-efficiency DNA, scaling from an 8-bit Arduino to an Intel XEON cloud server.
1011

1112
```
1213
NODEPP UNIFIED ARCHITECTURE: Co-designed components MODEL
@@ -32,15 +33,23 @@ NODEPP UNIFIED ARCHITECTURE: Co-designed components MODEL
3233

3334
## 📃 Whitepaper
3435

35-
[Scaling the Talent Bridge for Green Computing: Achieving Silicon-Logic Parity through Deterministic RAII](https://nodeppofficial.github.io/nodepp-doc/whitepaper) Read the full technical breakdown, including architectural deep-dives into `ptr_t`, `kernel_t` and `coroutine_t`.
36+
[Nodepp: Closing the Gap Between Bare-Metal Performance and Scripting Agility through Silicon-Logic Parity](https://nodeppofficial.github.io/nodepp-doc/whitepaper) Read the full technical breakdown, including architectural deep-dives into `ptr_t`, `kernel_t` and `coroutine_t`.
3637

37-
## 🌿 Sustainability & Performance (Green Computing)
38+
## ⭐ Architectural Philosophy
39+
40+
- **📌: 1. Deterministic RAII (`ptr_t`):** Eliminates the unpredictable latency spikes (Stop-the-World) of Garbage Collectors. By utilizing Small Stack Optimization (SSO) and reference counting, memory is reclaimed with microsecond precision.
41+
42+
- **📌: 2. Cooperative Multitasking (`coroutine_t`):** Stackless coroutines eliminate context-switching overhead. This allows for massive connection density on low-power hardware, from 8-bit industrial sensors to cloud-scale reactors.
43+
44+
- **📌: 3. Platform-Agnostic Reactor (`kernel_t`):** A unified abstraction over native kernel I/O `(Epoll, Kqueue, IOCP, and Npoll)`. It provides a consistent non-blocking interface across Linux, Windows, Mac, and Bare-Metal, ensuring that I/O multiplexing is always native to the silicon.
3845

39-
In the post-Moore's Law era, hardware is no longer infinitely cheap. Traditional managed runtimes (Node.js, Go, Java) prioritize abstractions that create a 11,000x Virtual Memory Gap. Nodepp reclaims this efficiency, enabling Resource-Dense Computing where a single node does the work of an entire cluster.
46+
## 🖕 Technical Reality Check: Data vs. Hype
4047

41-
### 📈 Performance Benchmark: HTTP Throughput vs. Resource Tax
48+
We didn't test this on a supercomputer. We tested it on an educational-grade Dual-Core Apollo Lake potato. If your framework can't perform here, it's not "scalable" — it's just hiding behind hardware.
4249

43-
> **Test:** 100k requests | 1k Concurrency | Environment: Localhost | Device: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/server_benchmark/readme.md)
50+
**1 - Performance Benchmark: HTTP Throughput vs. Resource Tax**
51+
52+
> **Test:** 100k requests | 1k Concurrency | Environment: Localhost [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/server_benchmark/readme.md)
4453
4554
| Metric | Bun (v1.3.5) | Go (v1.18.1) | Nodepp (V1.4.0) | Impact |
4655
| --- | --- | --- | --- | --- |
@@ -50,21 +59,21 @@ In the post-Moore's Law era, hardware is no longer infinitely cheap. Traditional
5059
| p99 Latency | 1,159 ms | 249 ms | 187 ms | High-precision SLA stability |
5160
| Energy Efficiency | Low | Medium | Extreme | Maximum hardware utilization |
5261

53-
### 📈 Performace Benchmark: Resource Management & Latency Jitter Analysis
62+
**2 - Performace Benchmark: Resource Management & Latency Jitter Analysis**
5463

55-
> **Test:** 1k Cycles | 100k Allocations | Environment: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/gc_benchmark/readme.md)
64+
> **Test:** 1k Cycles | 100k Allocations [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/gc_benchmark/readme.md)
5665
5766
| Runtime | Avg. Cycle Time | VIRT (Address Space) | RES (Physical RAM) | Memory Model |
5867
| --- | --- | --- | --- | --- |
5968
| Nodepp | 3.0 ms (±0.1 ms) | 6.1 MB | 2.7 MB | Deterministic RAII |
6069
| Bun | 7.2 ms (5-11 ms range) | 69.3 GB | 72.6 MB | Generational GC |
6170
| Go | < 1.0 ms* | 703.1 MB | 2.2 MB | Concurrent GC |
6271

63-
> **Note:** Go's <1ms measurement reflects allocation latency only; reclamation is deferred to concurrent garbage collection cycles.
72+
> **Note:** Go's <1ms measurement is a lie — it only reflects allocation latency. Reclamation is deferred to concurrent GC cycles, creating "ghost" resource pressure.
6473
65-
### 📈 Performace Benchmark: High-Concurrency Benchmark - 100k Task Challenge
74+
**3 - Performace Benchmark: High-Concurrency Benchmark - 100k Task Challenge**
6675

67-
> **Test:** 100k asynchronous tasks | Environment: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/task_benchmark/readme.md)
76+
> **Test:** 100k asynchronous tasks [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/task_benchmark/readme.md)
6877
6978
| Runtime | RSS (Memory) | CPU Load | VIRT Memory | Strategy |
7079
| --- | --- | --- | --- | --- |
@@ -73,9 +82,9 @@ Nodepp (Single) | 59.0 MB | 59.9% | 62 MB | Single Event Loop |
7382
Bun | 64.2 MB | 24.2% | 69.3 GB | JavaScriptCore Loop |
7483
Go | 127.9 MB | 169.4% | 772 MB | Preemptive Goroutines |
7584

76-
### 📈 Performace Benchmark: Nodepp Stability & Memory Benchmarks
85+
**4 - Performace Benchmark: Nodepp Stability & Memory Benchmarks**
7786

78-
> **Test:** 4 Valgrind-based stress tests | Environment: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/valgrind_benchmark/readme.md)
87+
> **Test:** 4 Valgrind-based stress tests [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/valgrind_benchmark/readme.md)
7988
8089
| Test Case | Objective | Iterations / Load | Memory Leaks | Result |
8190
| --- | --- | --- | --- | --- |
@@ -84,13 +93,52 @@ Go | 127.9 MB | 169.4% | 772 MB | Preemptive Goroutines |
8493
| Broken Pipe | Resilience to I/O failure | 100k interruptions | 0 bytes | PASSED |
8594
| Multi-Thread Atomicity | race conditions stress | 100k Messages * 2 workers | 0 bytes | PASSED |
8695

87-
## ⭐ Architectural Philosophy
96+
## 🚀 Why Nodepp Exists
8897

89-
- **📌: 1. Deterministic RAII (`ptr_t`):** Eliminates the unpredictable latency spikes (Stop-the-World) of Garbage Collectors. By utilizing Small Stack Optimization (SSO) and reference counting, memory is reclaimed with microsecond precision.
98+
The Nodepp Project did not originate in a laboratory; it was forged in the trenches of mission-critical Edge Computing and WASM development. While architecting ecosystems that bridge ESP32 hardware, web browsers, and cloud infrastructure, we identified a systemic crisis: the forced fragmentation of a single business logic across three incompatible execution environments.
9099

91-
- **📌: 2. Cooperative Multitasking (`coroutine_t`):** Stackless coroutines eliminate context-switching overhead. This allows for massive connection density on low-power hardware, from 8-bit industrial sensors to cloud-scale reactors.
100+
- **The Edge:** Native C/C++ for low-level hardware (High performance, near-zero agility).
101+
- **The Frontend:** JavaScript/WASM for browser interfaces (High agility, massive memory churn).
102+
- **The Infrastructure:** Managed Runtimes like Python, Go, or Node.js for server-side orchestration (High operational cost, unpredictable latency due to Garbage Collection).
103+
104+
Nodepp was built to collapse these silos. By providing a unified, asynchronous C++ runtime that mirrors the productivity of scripting languages, we enable Resource-Dense Computing.
105+
106+
```cpp
107+
#include <nodepp/nodepp.h>
108+
#include <nodepp/http.h>
109+
110+
using namespace nodepp;
111+
112+
void onMain() {
113+
114+
fetch_t args;
115+
args.method = "GET";
116+
args.url = "http://ip-api.com/json/?fields";
117+
args.headers = header_t({
118+
{ "Host", url::host(args.url) }
119+
});
120+
121+
http::fetch( args )
122+
123+
.then([]( http_t cli ){
124+
auto data = stream::await( cli );
125+
console::log("->", data.value());
126+
})
127+
128+
.fail([]( except_t err ){
129+
console::error( err );
130+
});
131+
132+
}
133+
```
134+
135+
We restore the direct relationship between code and hardware through Deterministic RAII and Stackless Coroutines, allowing you to deploy the same high-level logic from an 8-bit microcontroller to a 64-core cloud reactor without changing your mental model.
136+
137+
**Still Skeptical?**
138+
139+
Watch logic-parity in action. This isn't a "concept"—it's [ A Fully Functional Enigma Machine running in a Literal Potato board ](https://wokwi.com/projects/449104127751150593):
92140

93-
- **📌: 3. Platform-Agnostic Reactor (`kernel_t`):** A unified abstraction over native kernel I/O (Epoll, Kqueue, IOCP, and Npoll). It provides a consistent non-blocking interface across Linux, Windows, Mac, and Bare-Metal, ensuring that I/O multiplexing is always native to the silicon.
141+
https://github.com/user-attachments/assets/9b870671-3854-444f-893d-40fdce31a629
94142

95143
## 🧭 Quick Start: High-Density HTTP
96144
Nodepp abstracts complex socket management into a clean, event-driven API.
@@ -145,7 +193,8 @@ Nodepp is the only framework that lets you share logic between the deepest embed
145193
- **📌: Hardware:** [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino)
146194
- **📌: Desktop:** [Nodepp for Desktop](https://github.com/NodeppOfficial/nodepp)
147195
- **📌: Browser:** [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm)
148-
- **📌: IOT:** [ Nodepp for ESP32 ](https://github.com/NodeppOfficial/nodepp-esp32)
196+
- **📌: ESP32:** [Nodepp for ESP32](https://github.com/NodeppOfficial/nodepp-esp32)
197+
- **📌: EPS8266:** [Nodepp for ESP8266](https://github.com/NodeppOfficial/nodepp-esp8266)
149198

150199
## ❤️‍🩹 Contributing
151200

examples/35-Connect-to-API.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void onMain(){
2323
}
2424

2525
auto raw = stream::await( cli );
26-
auto obj = json::parse( raw );
26+
auto obj = json::parse ( raw.value() );
2727

2828
console::log( "country:", obj["country"].as<string_t>() );
2929
console::log( "city:" , obj["city"] .as<string_t>() );

examples/35-WS-Client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void onMain() {
1111

1212
client.onConnect([=]( ws_t cli ){
1313

14-
console::log("connected", cli.get_peername() );
14+
console::log("connected" );
1515

1616
cli.onData([]( string_t data ){
1717
console::log( data );

examples/36-WS-Server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void onMain(){
2222

2323
server.onConnect([=]( ws_t cli ){
2424

25-
console::log("connected", cli.get_peername() );
25+
console::log("connected" );
2626

2727
cli.onData([=]( string_t data ){
2828
console::log( data );

examples/39-LoadBalancing.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ using namespace nodepp;
1212
void server( int process ){
1313

1414
auto server = http::server([=]( http_t cli ){
15+
16+
console::log( ">>", cli.path );
1517

1618
cli.write_header( 200, header_t({
1719
{ "Content-Type", "text/html" }
@@ -32,9 +34,15 @@ void onMain(){
3234

3335
if ( process::is_child() ){ server( os::pid() ); } else {
3436
for( auto x = os::cpus(); x--; ){
35-
cluster::add().onData([=]( string_t data ){
37+
38+
auto pid = cluster::add();
39+
40+
if ( !pid.has_value() ){ throw except_t( "something went wrong" ); }
41+
42+
pid.value().onData([=]( string_t data ){
3643
conio::log( data );
3744
});
45+
3846
}}
3947

4048
}

examples/40-Cluster.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ using namespace nodepp;
77
void onMain() {
88

99
if( process::is_parent() ){
10+
1011
auto pid = cluster::add();
1112

12-
pid.onDrain([=](){ console::log("Done"); });
13-
pid.onData([=]( string_t data ){
13+
if( !pid.has_value() ){ throw except_t( "something went wrong" ); }
14+
15+
pid.value().onDrain([=](){ console::log("Done"); });
16+
pid.value().onData ([=]( string_t data ){
1417
console::log("->",data);
1518
});
1619

1720
} else {
21+
1822
process::add( coroutine::add( COROUTINE(){
1923
static uint x = 10;
2024
coBegin

examples/40-Popen.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ using namespace nodepp;
55

66
void onMain(){
77

8-
auto pid = popen::async( "curl https://www.google.com -Ls" );
8+
auto pid = popen::add( "curl https://www.google.com -Ls" );
99

10-
pid.onData([]( string_t data ){ console::log( data ); });
11-
pid.onClose([=](){ console::log("done"); });
10+
if( !pid.has_value() ){
11+
throw except_t( "something went wrong" );
12+
}
13+
14+
pid.value().onData([]( string_t data ){
15+
console::log( data );
16+
});
17+
18+
pid.value().onClose([=](){
19+
console::log("done");
20+
});
1221

1322
}

examples/45-TCPClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void onMain(){
1010

1111
client.onOpen([=]( socket_t cli ){
1212

13-
console::log("connected", cli.get_peername() );
13+
console::log("connected" );
1414

1515
cli.onData([=]( string_t data ){
1616
console::log( data );

examples/46-TCPServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void onMain(){
1010

1111
server.onConnect([=]( socket_t cli ){
1212

13-
console::log("connected", cli.get_peername() );
13+
console::log("connected" );
1414

1515
cli.onData([=]( string_t data ){
1616
console::log( data );

examples/47-UDPClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void onMain(){
1010

1111
client.onConnect([=]( socket_t cli ){
1212

13-
console::log("connected", cli.get_peername() );
13+
console::log("connected" );
1414

1515
cli.onData([=]( string_t data ){
1616
console::log( data );

0 commit comments

Comments
 (0)