Conversation
|
Review requested:
|
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
|
@nodejs/performance |
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
Failed to start CI⚠ Commits were pushed since the last approving review: ⚠ - buffer: optimize Buffer.copy ⚠ - Update v8-array-buffer.h ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/23705961064 |
There was a problem hiding this comment.
This is essentially a free unchecked memmove exposed to user world through Buffer API
Which can be used to freely read/write process memory
It should at least crash the process if proper error handling is impossible, not write/read arbitrary process mem
Without such check this, like #59985, is degrading whatever fragile protections e.g. --permission offers even further
Would look good with a check though, nice perf improvement!
|
The check is done in js. Doing checks in fast api context is difficult since as far as I'm aware you can't throw from there. Please unblock. |
|
Either way I don't see how this is worse than it was before. Feels like scope creep: |
|
If you feel strongly about the check please open a pr and fix it properly across all the other methods as well. As you wrote in the issue. Messing around with prototypes is not supported. |
|
Can you upstream the V8 changes first? In general floating patches is reserved for toolchains/platforms V8 doesn't support, that adds maintenance burden to rebase the patches during V8 updates especially when V8 does any architectural changes (e.g. they are constantly changing how handles should be used internally, which can easily turns patches like this an upgrade blocker), so it's always better to merge them first in the upstream. |
I don't think it's likely to land and I don't know how to upstream to V8. If that's a blocker for you then this PR is moot. I appreciate the maintenance burden and if those that have to deal with it object then I have no objection to closing this PR. |
joyeecheung
left a comment
There was a problem hiding this comment.
I think this needs to be upstreamed first. I could catch the pointer issue from a glance. But I don't think I know enough to gauge the internal API uses are safe and along the lines of where V8 is going without review from people in the V8 team. Floating patches can both add maintenance burden to our V8 upgrades as well as V8's integration CI (they build Node.js with different configurations there e.g. with pointer compression and could get hit by a different set of problems). They are generally reserved for things that V8 defer to others (MSVC support or niche platform support - even in those cases we still try to upstream to minimize the burden, like the big endian patches), not things like features or performance optimizations.
|
Understood. Unfortunate. Was a significant perf boost. |
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
This removes some of the overhead by extending the V8 api. PR-URL: nodejs#62491
|
Benchmark results: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62491 +/- ##
==========================================
- Coverage 91.55% 89.70% -1.85%
==========================================
Files 351 692 +341
Lines 147653 213981 +66328
Branches 23224 41050 +17826
==========================================
+ Hits 135179 191948 +56769
- Misses 12217 14110 +1893
- Partials 257 7923 +7666
🚀 New features to boost your workflow:
|
|
I like it, but yeah, I agree with @joyeecheung ... an attempt to upstream this into v8 should be made first. |
It isn't robust (as I mentioned above).
You can crash the process (again, as mentioned), which is better than reading/writing arbitrary process memory. |
|
I've funded work to upstream this to V8. Hopefully this will be able to land in the future without blocking nits. |
This removes some of the overhead by extending the V8 api.