patx/micropie
Update README.md
Commit 4658f5e · Harrison Erd · 2025-01-29T03:57:08-05:00
Comments
No comments yet.
Diff
diff --git a/README.md b/README.md
index c4521ba..fc3e524 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
## **Introduction**
-**MicroPie** is a lightweight, modern Python web framework that supports asynchronous web applications. Designed with flexibility and simplicity in mind, MicroPie enables you to handle high-concurrency HTTP applications with ease while allowing easy and natural integration with external tools like Socket.IO for real-time communication.
+**MicroPie** is a fast, lightweight, modern Python web framework that supports asynchronous web applications. Designed with flexibility and simplicity in mind, MicroPie enables you to handle high-concurrency HTTP applications with ease while allowing natural integration with external tools like Socket.IO for real-time communication.
### **Key Features**
- 🔄 **Routing:** Automatic mapping of URLs to functions with support for dynamic and query parameters.
@@ -65,13 +65,17 @@ MicroPie automatically maps URLs to methods within your `Server` class. Routes c
For GET requests, pass data through query strings or URL path segments, automatically mapped to method arguments.
```python
class MyApp(Server):
- def async greet(self, name="Guest"):
+ async def greet(self, name="Guest"):
return f"Hello, {name}!"
+
+ async def hello(self):
+ name = self.query_params.get("name", None)
+ return f"Hello {name}!"
```
**Access:**
-- [http://127.0.0.1:8000/greet?name=Alice](http://127.0.0.1:8000/greet?name=Alice) returns `Hello, Alice!`
-- [http://127.0.0.1:8000/greet/Alice](http://127.0.0.1:8000/greet/Alice) returns `Hello, Alice!`
-
+- [http://127.0.0.1:8000/greet?name=Alice](http://127.0.0.1:8000/greet?name=Alice) returns `Hello, Alice!`, same as [http://127.0.0.1:8000/greet/Alice](http://127.0.0.1:8000/greet/Alice) returns `Hello, Alice!`
+- [http://127.0.0.1:800/hello/Alice](http://127.0.0.1:800/hello/Alice) returns `Hello Alice!`, same as [http://127.0.0.1:800/hello?name=Alice](http://127.0.0.1:800/hello?name=Alice) returns `Hello Alice!`
+
### **2. Flexible HTTP POST Request Handling**
MicroPie also supports handling form data submitted via HTTP POST requests. Form data is automatically mapped to method arguments. It is able to handle default values and raw POST data:
```python
@@ -173,7 +177,7 @@ MicroPie allows you to take full advantage of these benefits while maintaining s
## **Comparisons**
-### **Features vs Other Popular Frameworks*
+### **Features vs Other Popular Frameworks**
| Feature | MicroPie | Flask | CherryPy | Bottle | Django | FastAPI |
|---------------------|---------------|--------------|------------|--------------|--------------|-----------------|
| **Ease of Use** | Very Easy | Easy | Easy | Easy | Moderate | Moderate |
@@ -184,22 +188,27 @@ MicroPie allows you to take full advantage of these benefits while maintaining s
| **Built-in Server** | No | No | Yes | Yes | Yes | No |
### **Performance vs Other ASGI Frameworks**
-| Framework | Threads | Connections | Duration (s) | Requests/sec | Latency (ms) | Transfer/sec (KB) |
-|------------|----------:|--------------:|---------------:|---------------:|---------------:|--------------------:|
-| FastAPI | 4 | 100 | 30 | 1895.29 | 52.67 | 257.54 |
-| MicroPie | 4 | 100 | 30 | 2272.76 | 43.93 | 362.18 |
-| Quart | 4 | 100 | 30 | 1500.13 | 66.63 | 212.68 |
-| Starlette | 4 | 100 | 30 | 2305.50 | 43.30 | 326.88 |
-| FastAPI | 4 | 200 | 30 | 2015.90 | 99.78 | 273.94 |
-| MicroPie | 4 | 200 | 30 | 2516.01 | 79.31 | 400.92 |
-| Quart | 4 | 200 | 30 | 1574.15 | 126.63 | 223.16 |
-| Starlette | 4 | 200 | 30 | 2658.45 | 75.10 | 376.86 |
-| FastAPI | 4 | 1000 | 30 | 2129.72 | 463.63 | 289.44 |
-| MicroPie | 4 | 1000 | 30 | 2589.64 | 381.86 | 412.79 |
-| Quart | 4 | 1000 | 30 | 1557.83 | 628.80 | 221.01 |
-| Starlette | 4 | 1000 | 30 | 2887.07 | 342.99 | 409.37 |
-
-*Tests were performed with `uvicorn` using 4 workers. Benchmarked with `wrk`. This a minimal baseline benchmark, and should be taken with a grain of salt.*
+| Connections | Framework | Requests/sec | Latency (ms) | Transfer/sec (KB) |
+|-------------|------------|--------------|--------------|--------------------|
+| 100 | FastAPI | 1895.29 | 52.67 | 257.54 |
+| | MicroPie | 2272.76 | 43.93 | 362.18 |
+| | Quart | 1500.13 | 66.63 | 212.68 |
+| | Starlette | 2305.50 | 43.30 | 326.88 |
+| 200 | FastAPI | 2015.90 | 99.78 | 273.94 |
+| | MicroPie | 2516.01 | 79.31 | 400.92 |
+| | Quart | 1574.15 | 126.63 | 223.16 |
+| | Starlette | 2658.45 | 75.10 | 376.86 |
+| 1000 | FastAPI | 2129.72 | 463.63 | 289.44 |
+| | MicroPie | 2589.64 | 381.86 | 412.79 |
+| | Quart | 1557.83 | 628.80 | 221.01 |
+| | Starlette | 2887.07 | 342.99 | 409.37 |
+
+
+Starlette performs best, maintaining the highest throughput and low latency due to its heavily optimized architecture. MicroPie also excels, especially at high concurrency,
+benefiting from lightweight processing. FastAPI offers stable performance but suffers increased latency under load, likely due to request validation overhead. Quart
+performs the worst, with high latency and low throughput, likely due to its Flask compatibility, making it less suited for high-concurrency workloads.
+
+*Tests were performed on a Star Labs StarLite Mk IV with `uvicorn` using 4 workers. Benchmarked with `wrk` with 4 threads for 30s. This a minimal baseline benchmark, and should be taken with a grain of salt.*
## **Suggestions or Feedback?**
We welcome suggestions, bug reports, and pull requests!