Comments (3)
(unrelated to Node.js, but bonus points to anyone that feels like surfacing a similar fix with browser engines, as they seem to suffer from the same bottleneck)
from node.
As I understand it currently, URL
stores its entire value in #context.href
as a single string (and associated pointers for search etc.). When instantiated, URL
does not have an associated URLSearchParams
. If, and only if, a user accesses searchParams
on URL
, then a URLSearchParams
is instantiated for the URL
. However, URL
still relies on its own #context.href
value always, and so the data in URLSearchParams
is essentially a duplicate, and any update to it needs to call the search
setter on URL
so that #context.href
can be updated properly.
Thinking through this, I think the approach to fixing this might be:
- Remove the
URL
#context
fromURLSearchParams
, so it is a properly independent data store - Update the
search
+href
getters inURL
to interface withsearchParams
if it exists - Update the
search
+href
setters inURL
to interface withsearchParams
if it exists, and not pass any search to the internal#context.href
, so it is just stored insearchParams
(or, rather, update#updateContext
to slice the returnedhref
and not store the search index whensearchParams
exists) - Update
searchParams
so that when it instantiatesURLSeachParams
, it also removes any search from the internal#context.href
, so it is just stored insearchParams
(probably via the same#updateContext
modification)
This does mean that the internal #context.href
value of URL
will not contain the search string once searchParams
has been accessed, but I think that is probably the best thing to do so there is no risk of future confusion with the state of that being potentially out of sync with searchParams
.
from node.
@anonrig @nodejs/performance
from node.
Related Issues (20)
- Creating a lot of worker threads at once doesn't fully release their memory once they're terminated HOT 6
- BuildSnapshot fails with result->early_return() HOT 1
- 'node:test' - expose a `seed` to allow reproducible tests with pseudo random generators
- Inaccurate sentence about the event loop tick and the process.nextTick HOT 1
- 404 hyperlink in nextTick documentation
- Djdjd
- IO_uring caused regression on node 20 and node 21 HOT 2
- `node:module` `register` hook chaining order behavior is incorrect HOT 5
- [node:test] test.only does not work without it being wrapped in describe.only HOT 2
- parallel/test-http-chunk-extensions-limit is flaky
- Nominate Ulises Gascón (UlisesGascon) as a collaborator HOT 3
- `"packageManager"` field doesn’t support npm HOT 21
- BSON upgrade from 1.1.4 to 4.7.2 causes issue with Joi validation HOT 2
- Async/await code running twice HOT 1
- npm install <git remote url> when git group/namespace starts with a number HOT 1
- awaiting some fs/promises API (readdir, readfile) breaks later try catch block HOT 3
- Set maximum size exceeded HOT 2
- Nominating @UlisesGascon as a collaborator HOT 1
- Issue with `-i` shorthand for `--import` not loading subsequent file HOT 1
- test_runner: full diff option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node.