snow-flow 4.1.2 → 4.2.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.
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /**
3
+ * Memory Pool Manager
4
+ * Optimizes Map/Set allocations and reuses objects for better memory efficiency
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MemoryPoolManager = void 0;
8
+ class MemoryPoolManager {
9
+ /**
10
+ * Get a reusable Map instance
11
+ */
12
+ static getMap() {
13
+ if (this.mapPool.length > 0) {
14
+ const map = this.mapPool.pop();
15
+ map.clear(); // Ensure it's clean
16
+ return map;
17
+ }
18
+ return new Map();
19
+ }
20
+ /**
21
+ * Return a Map to the pool for reuse
22
+ */
23
+ static releaseMap(map) {
24
+ if (this.mapPool.length < this.MAX_POOL_SIZE) {
25
+ map.clear();
26
+ this.mapPool.push(map);
27
+ }
28
+ }
29
+ /**
30
+ * Get a reusable Set instance
31
+ */
32
+ static getSet() {
33
+ if (this.setPool.length > 0) {
34
+ const set = this.setPool.pop();
35
+ set.clear(); // Ensure it's clean
36
+ return set;
37
+ }
38
+ return new Set();
39
+ }
40
+ /**
41
+ * Return a Set to the pool for reuse
42
+ */
43
+ static releaseSet(set) {
44
+ if (this.setPool.length < this.MAX_POOL_SIZE) {
45
+ set.clear();
46
+ this.setPool.push(set);
47
+ }
48
+ }
49
+ /**
50
+ * Get a reusable object
51
+ */
52
+ static getObject() {
53
+ if (this.objectPool.length > 0) {
54
+ return this.objectPool.pop();
55
+ }
56
+ return {};
57
+ }
58
+ /**
59
+ * Return an object to the pool
60
+ */
61
+ static releaseObject(obj) {
62
+ if (this.objectPool.length < this.MAX_POOL_SIZE) {
63
+ // Clear all properties
64
+ for (const key in obj) {
65
+ delete obj[key];
66
+ }
67
+ this.objectPool.push(obj);
68
+ }
69
+ }
70
+ /**
71
+ * Get pool statistics for monitoring
72
+ */
73
+ static getStats() {
74
+ return {
75
+ maps: {
76
+ available: this.mapPool.length,
77
+ maxSize: this.MAX_POOL_SIZE
78
+ },
79
+ sets: {
80
+ available: this.setPool.length,
81
+ maxSize: this.MAX_POOL_SIZE
82
+ },
83
+ objects: {
84
+ available: this.objectPool.length,
85
+ maxSize: this.MAX_POOL_SIZE
86
+ }
87
+ };
88
+ }
89
+ /**
90
+ * Clear all pools (for testing/cleanup)
91
+ */
92
+ static clearPools() {
93
+ this.mapPool.length = 0;
94
+ this.setPool.length = 0;
95
+ this.objectPool.length = 0;
96
+ }
97
+ }
98
+ exports.MemoryPoolManager = MemoryPoolManager;
99
+ MemoryPoolManager.mapPool = [];
100
+ MemoryPoolManager.setPool = [];
101
+ MemoryPoolManager.objectPool = [];
102
+ MemoryPoolManager.MAX_POOL_SIZE = 50;
103
+ //# sourceMappingURL=memory-pool.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "description": "ENTERPRISE SCALE - v4.1.0 removes ALL artificial limits! Built on stable v3.6.25 with enterprise-grade support for massive widgets (5MB+ scripts), 200k token fields, and 100k record queries.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",