evg_observable 2.15.5 → 2.15.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/package.json +3 -1
- package/src/outLib/Collector.js +1 -1
- package/src/outLib/Observable.js +1 -1
- package/src/outLib/OrderedObservable.js +1 -1
package/README.md
CHANGED
|
@@ -69,6 +69,57 @@ RxJS is better when you need specialized operators like `debounceTime`, `throttl
|
|
|
69
69
|
|
|
70
70
|
---
|
|
71
71
|
|
|
72
|
+
## EVG Observable vs Lightweight Competitors
|
|
73
|
+
|
|
74
|
+
Comparison with lightweight libraries in the same weight category (observable-fns):
|
|
75
|
+
|
|
76
|
+
| Metric | EVG Observable | observable-fns |
|
|
77
|
+
|--------|----------------|----------------|
|
|
78
|
+
| **Weekly downloads** | Growing | 67K |
|
|
79
|
+
| **Bundle size (minified)** | 6.3 kB | 10.8 kB |
|
|
80
|
+
| **Implementation** | Original architecture | zen-observable re-implementation |
|
|
81
|
+
| **Dependencies** | 0 | 0 |
|
|
82
|
+
| **Architecture** | True hot observables | Cold observables (zen-observable API) |
|
|
83
|
+
|
|
84
|
+
### Performance Comparison: Emissions
|
|
85
|
+
|
|
86
|
+
Basic emission performance across different subscriber counts:
|
|
87
|
+
|
|
88
|
+
| Scenario | EVG Observable | observable-fns | Advantage |
|
|
89
|
+
|----------|----------------|----------------|-----------|
|
|
90
|
+
| 1 emit × 1 subscriber | 57.2M ops/sec | 37.0M | **1.5x faster** |
|
|
91
|
+
| 1 emit × 10 subscribers | 17.1M ops/sec | 6.4M | **2.7x faster** |
|
|
92
|
+
| 1 emit × 100 subscribers | 2.1M ops/sec | 736K | **2.9x faster** |
|
|
93
|
+
| 1 emit × 1000 subscribers | 207K ops/sec | 73K | **2.8x faster** |
|
|
94
|
+
| 1 emit × 10000 subscribers | 18.7K ops/sec | 7.1K | **2.6x faster** |
|
|
95
|
+
| 100 emit × 1 subscriber | 1.2M ops/sec | 560K | **2.1x faster** |
|
|
96
|
+
| 100 emit × 100 subscribers | 21.6K ops/sec | 7.6K | **2.8x faster** |
|
|
97
|
+
| 1000 emit × 1000 subscribers | 215 ops/sec | 77 | **2.8x faster** |
|
|
98
|
+
| Large payload (complex objects) | 815K ops/sec | 557K | **1.5x faster** |
|
|
99
|
+
| Observable creation | 54.5M ops/sec | 17.9M | **3.0x faster** |
|
|
100
|
+
|
|
101
|
+
**Key Insights:**
|
|
102
|
+
- EVG Observable is consistently **1.5x-3.0x faster** across all emission scenarios
|
|
103
|
+
- Performance advantage remains stable from 1 to 10,000 subscribers
|
|
104
|
+
- Both libraries scale well for basic emission patterns
|
|
105
|
+
- EVG Observable's true hot observable architecture provides better performance for multi-subscriber scenarios
|
|
106
|
+
|
|
107
|
+
**When to choose EVG Observable:**
|
|
108
|
+
- Real-time data broadcasting (WebSocket, server events)
|
|
109
|
+
- Multiple active subscribers (2+)
|
|
110
|
+
- Performance-critical applications
|
|
111
|
+
- Hot observable patterns (subjects, event emitters)
|
|
112
|
+
|
|
113
|
+
**When to consider observable-fns:**
|
|
114
|
+
- Single subscriber scenarios
|
|
115
|
+
- Cold observable patterns (HTTP requests, async operations)
|
|
116
|
+
- Prefer functional programming style
|
|
117
|
+
- Need async filter/map handlers
|
|
118
|
+
|
|
119
|
+
*Full benchmark results including filter chains and transformations available in [benchmarks/benchmark-readme.md](./benchmarks/benchmark-readme.md)*
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
72
123
|
## What is EVG Observable?
|
|
73
124
|
|
|
74
125
|
EVG Observable is a robust, lightweight library designed for handling asynchronous events. What sets it apart is its
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evg_observable",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.7",
|
|
4
4
|
"description": "Alternative fast and light library version - observable.",
|
|
5
5
|
"main": "src/outLib/index.js",
|
|
6
6
|
"types": "src/outLib/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"build": "tsc --declaration; npm run remove",
|
|
14
14
|
"benchmark": "ts-node benchmarks/benchmark.ts",
|
|
15
15
|
"benchmark:comparison": "ts-node benchmarks/benchmark-comparison.ts",
|
|
16
|
+
"benchmark:competitors": "ts-node benchmarks/benchmark-competitors.ts",
|
|
16
17
|
"benchmark:browser": "ts-node benchmarks/benchmark-browser-bundle.ts",
|
|
17
18
|
"benchmark:bundles": "ts-node benchmarks/benchmark-bundles.ts"
|
|
18
19
|
},
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
"microtime": "^3.1.1",
|
|
36
37
|
"mocha": "^11.7.5",
|
|
37
38
|
"nyc": "^17.1.0",
|
|
39
|
+
"observable-fns": "^0.6.1",
|
|
38
40
|
"rxjs": "^7.8.2",
|
|
39
41
|
"ts-node": "^10.9.1",
|
|
40
42
|
"typescript": "^5.4.5"
|
package/src/outLib/Collector.js
CHANGED
|
@@ -13,7 +13,7 @@ class Collector {
|
|
|
13
13
|
if (this.killed)
|
|
14
14
|
return;
|
|
15
15
|
subscriptionLike?.unsubscribe();
|
|
16
|
-
(0, FunctionLibs_1.
|
|
16
|
+
(0, FunctionLibs_1.deleteFromArray)(this.arr, subscriptionLike);
|
|
17
17
|
}
|
|
18
18
|
unsubscribeAll() {
|
|
19
19
|
if (this.killed)
|
package/src/outLib/Observable.js
CHANGED
|
@@ -41,7 +41,7 @@ class OrderedObservable extends Observable_1.Observable {
|
|
|
41
41
|
this.trash.push(listener);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
this.subs && !(0, FunctionLibs_1.
|
|
44
|
+
this.subs && !(0, FunctionLibs_1.deleteFromArray)(this.subs, listener);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.OrderedObservable = OrderedObservable;
|