iterflow 0.4.0 → 0.5.0
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 +56 -0
- package/package.json +16 -2
package/README.md
CHANGED
|
@@ -221,7 +221,63 @@ const movingAverages = iter(temperatures)
|
|
|
221
221
|
.toArray();
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
+
## When to Use iterflow
|
|
225
|
+
|
|
226
|
+
iterflow balances developer experience with performance. Here's how to decide:
|
|
227
|
+
|
|
228
|
+
### Use iterflow when:
|
|
229
|
+
|
|
230
|
+
- **Large datasets** (1000+ items) - lazy evaluation avoids unnecessary work
|
|
231
|
+
- **Early termination** - finding first match, taking limited results (find, some, every, take)
|
|
232
|
+
- **Memory efficiency** - windowing, chunking, or processing huge files
|
|
233
|
+
- **Complex pipelines** - chaining 3+ operations together
|
|
234
|
+
- **Statistical operations** - mean, median, variance, percentile calculations
|
|
235
|
+
- **Code readability** - method chaining feels more natural than manual loops
|
|
236
|
+
|
|
237
|
+
### Consider alternatives when:
|
|
238
|
+
|
|
239
|
+
- **Small arrays** (< 100 items) - native Array methods are slightly faster
|
|
240
|
+
- **Single simple operation** - map or filter alone on small data
|
|
241
|
+
- **Performance-critical hot paths** - called millions of times, every microsecond matters
|
|
242
|
+
- **Need multiple iterations** - arrays are easier to loop over multiple times
|
|
243
|
+
|
|
244
|
+
### The Trade-off
|
|
245
|
+
|
|
246
|
+
iterflow uses lazy evaluation, which means:
|
|
247
|
+
- **Lower memory usage** - no intermediate arrays created
|
|
248
|
+
- **Slightly slower per operation** - small function call overhead
|
|
249
|
+
- **Better for large datasets** - memory savings far exceed speed cost
|
|
250
|
+
- **Better for partial consumption** - stops early when possible
|
|
251
|
+
|
|
252
|
+
### Real Performance Impact
|
|
253
|
+
|
|
254
|
+
For datasets < 100 items, the differences are negligible—use what feels natural.
|
|
255
|
+
|
|
256
|
+
For datasets > 1000 items:
|
|
257
|
+
- **With early termination** (take 10 from 100K): iterflow can be 20-300x faster
|
|
258
|
+
- **With windowing** (moving average): iterflow can be 35-600x faster due to memory efficiency
|
|
259
|
+
- **Full consumption** (process all items): native arrays are 2-5x faster
|
|
260
|
+
|
|
261
|
+
See **[docs/BENCHMARKS.md](docs/BENCHMARKS.md)** for detailed performance data and specific operation comparisons.
|
|
262
|
+
|
|
224
263
|
<!-- BENCHMARK_SUMMARY_START -->
|
|
264
|
+
## Performance
|
|
265
|
+
|
|
266
|
+
iterflow balances performance with developer experience. Here's how it performs across different operation categories:
|
|
267
|
+
|
|
268
|
+
| Category | vs Native | vs Lodash | vs Ramda | Operations Tested |
|
|
269
|
+
|----------|-----------|-----------|----------|-------------------|
|
|
270
|
+
| Transformations | 10.8x slower | 6.9x slower | 8.9x slower | 13 |
|
|
271
|
+
| Statistics | N/A | 1.8x slower | 1.4x slower | 14 |
|
|
272
|
+
| Windowing | N/A | 6.1x slower | 8.7x slower | 13 |
|
|
273
|
+
| Terminals | 5.8x slower | 2.6x slower | 5.1x slower | 13 |
|
|
274
|
+
| Lazy Evaluation | 2.8x slower | N/A | 12.9x slower | 3 |
|
|
275
|
+
| Memory Profiling | N/A | N/A | N/A | 0 |
|
|
276
|
+
| Production Profiling | N/A | N/A | N/A | 0 |
|
|
277
|
+
|
|
278
|
+
**Detailed benchmarks:** See [docs/BENCHMARKS.md](docs/BENCHMARKS.md) for comprehensive performance data.
|
|
279
|
+
|
|
280
|
+
*Last updated: December 22, 2025 (v0.4.0)*
|
|
225
281
|
<!-- BENCHMARK_SUMMARY_END -->
|
|
226
282
|
|
|
227
283
|
## Documentation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iterflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Powerful iterator utilities for ES2022+ with statistical operations, windowing, and lazy evaluation. Forward compatible with ES2025 iterator helpers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -41,7 +41,21 @@
|
|
|
41
41
|
"validate-commits": "node scripts/validate-commits.js",
|
|
42
42
|
"prepublishOnly": "npm run build && npm test && npm run test:types",
|
|
43
43
|
"website:dev": "cd website && npm run dev",
|
|
44
|
-
"website:build": "npm run build && cd website && npm run build && cd .. && npm run docs"
|
|
44
|
+
"website:build": "npm run build && cd website && npm run build && cd .. && npm run docs",
|
|
45
|
+
"bench:transformations": "vitest bench --run benchmarks/transformations.bench.ts",
|
|
46
|
+
"bench:statistics": "vitest bench --run benchmarks/statistics.bench.ts",
|
|
47
|
+
"bench:windowing": "vitest bench --run benchmarks/windowing.bench.ts",
|
|
48
|
+
"bench:terminals": "vitest bench --run benchmarks/terminals.bench.ts",
|
|
49
|
+
"bench:lazy-evaluation": "vitest bench --run benchmarks/lazy-evaluation.bench.ts",
|
|
50
|
+
"bench:memory-profiling": "vitest bench --run benchmarks/memory-profiling.bench.ts",
|
|
51
|
+
"bench:production-profiling": "vitest bench --run benchmarks/production-profiling.bench.ts",
|
|
52
|
+
"bench:quick": "VITEST_BENCH_TIME=1000 node scripts/run-benchmarks.cjs",
|
|
53
|
+
"bench:all": "node scripts/run-benchmarks.cjs",
|
|
54
|
+
"bench:report": "node scripts/generate-benchmark-report.cjs",
|
|
55
|
+
"bench:update-readme": "node scripts/update-readme-benchmarks.cjs",
|
|
56
|
+
"bench:update-changelog": "node scripts/update-changelog-benchmarks.cjs",
|
|
57
|
+
"bench:full": "npm run bench:all && npm run bench:report && npm run bench:update-readme",
|
|
58
|
+
"bench:workflow": "bash scripts/run-benchmarks-full.sh"
|
|
45
59
|
},
|
|
46
60
|
"keywords": [
|
|
47
61
|
"iterator",
|