Commit ca579ec
committed
http,net: optimize repeated property access
Cache frequently accessed properties to reduce property lookup overhead:
- HTTP Agent constructor: Cache `this.options` in local variable to
eliminate 14+ property access chains during initialization
- net.Socket.setNoDelay: Cache `this._handle` to avoid repeated access
- net.Socket.setKeepAlive: Cache `this._handle` to avoid repeated access
These optimizations target hot paths in network operations, reducing
object traversal overhead during socket configuration and HTTP agent
instantiation.
Signed-off-by: jbj338033 <[email protected]>1 parent 3e79dba commit ca579ec
2 files changed
+25
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | | - | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
122 | 125 | | |
123 | 126 | | |
124 | | - | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | | - | |
| 617 | + | |
| 618 | + | |
618 | 619 | | |
619 | | - | |
| 620 | + | |
620 | 621 | | |
621 | 622 | | |
622 | 623 | | |
| |||
633 | 634 | | |
634 | 635 | | |
635 | 636 | | |
636 | | - | |
| 637 | + | |
| 638 | + | |
637 | 639 | | |
638 | 640 | | |
639 | 641 | | |
| |||
645 | 647 | | |
646 | 648 | | |
647 | 649 | | |
648 | | - | |
| 650 | + | |
649 | 651 | | |
650 | 652 | | |
651 | 653 | | |
| |||
0 commit comments