-
Notifications
You must be signed in to change notification settings - Fork 358
Description
While developing undici-fetch and subsequently adding a fetch-based Headers class to Node.js, we discovered that a 1D list of header entries is very efficient.
The implementation developed optimizes across multiple use cases (insert, iteration, and look up) so that any use of the instance is still efficient.
Based on this comment thread in the Node.js PR, I anticipate this kind of change may not land, but I think it would be valuable to discuss anyways.
The proposed change could be as simple as just allowing 1D array as an init
argument and only adding some extra details to cast it to the existing, 2D headers list
backing data structure for the Header api. A more complex (and assumingely unlikely) change would be to update the spec to utilize the 1D based implementation proposed to the Node API.