| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Can you resolve the conflict @littledivy? |
Sorry, something went wrong.
There was a problem hiding this comment.
Guess we have to add a test like in test/parallel/test-url-canParse-whatwg.js ?
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
| uv_fs_t req; | ||
| auto make = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); }); | ||
| FS_SYNC_TRACE_BEGIN(access); | ||
| int err = uv_fs_access(nullptr, &req, path.out(), 0, nullptr); | ||
| FS_SYNC_TRACE_END(access); | ||
|
|
||
| #ifdef _WIN32 | ||
| // In case of an invalid symlink, `uv_fs_access` on win32 | ||
| // will **not** return an error and is therefore not enough. | ||
| // Double check with `uv_fs_stat()`. | ||
| if (err == 0) { | ||
| FS_SYNC_TRACE_BEGIN(stat); | ||
| err = uv_fs_stat(nullptr, &req, path.out(), nullptr); | ||
| FS_SYNC_TRACE_END(stat); | ||
| } | ||
| #endif // _WIN32 |
There was a problem hiding this comment.
The fs operation part can be wrapped in a helper and shared with the slow callback to avoid getting out of sync.
Sorry, something went wrong.
| // This test is to ensure that the v8 fast api works. | ||
| const oneBytePath = 'hello.txt'; | ||
| for (let i = 0; i < 1e5; i++) { | ||
| assert(!fs.existsSync(oneBytePath)); |
There was a problem hiding this comment.
This should be moved to test/pummel instead. But also, in general we need to avoid running tight loops in the tests to avoid introducing timeouts in the CI on the slower machines. Maybe it's already enough that the fast path is exercised in the benchmark..
Sorry, something went wrong.
There was a problem hiding this comment.
Can't we use V8 natives API like they do unit test fast calls? IIRC you need to %PrepareForOptimization(fn), call the function, %OptimizeOnNextCall(fn), and call it again. That last call should be optimized.
Sorry, something went wrong.
There was a problem hiding this comment.
Also, while I'm not good enough with C++ to suggest how to implement it, I think we can put something into place (maybe only in debug builds?). For example, the fast version, when called, increases some counter that we can get from JavaScript for an assertion.
Sorry, something went wrong.
There was a problem hiding this comment.
I think we can keep an array of booleans for all fast APIs to see if they are called, and expose them to the JS land, toggling a boolean shouldn't be very expensive.
Sorry, something went wrong.
There was a problem hiding this comment.
For this PR though doing %PrepareForOptimization() and %OptimizeOnNextCall() in the tests may be fine. But we also need to check in JS land if the optimizing compiler is enabled at all in the test to avoid failing on builds that turns optimizations off, which would be tricky..
Sorry, something went wrong.
Using `await fs.access` has couple of downsides. It creates unnecessary async contexts where async scope can be removed. Also, it creates the possibility of race conditions such as `Time-of-Check to Time-of-Use`. It would be nice if someone can benchmark this. I'm rooting for a performance improvement. Some updates from Node.js land: - There is an open pull request to add V8 Fast API to `existsSync` method - nodejs/node#49893 - Non-existing `existsSync` executions became 30% faster - nodejs/node#49593 Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
|
This needs a rebase. |
Sorry, something went wrong.
|
👋 Hey, this has approvals and a decent number of reviews, but currently has conflcits with the main branch. @aduh95 pointed out a few months ago that this needs a rebase, but no action has been taken since then. I've marked this PR as stalled for these reasons, LMK if this wasn't the right thing to do, and feel free to undo it :-). |
Sorry, something went wrong.
|
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
Sorry, something went wrong.
|
Sorry, I haven't had a chance to rebase. Please feel free to take over and get this landed. |
Sorry, something went wrong.
|
You can always re-open, the stalled bot isn't working, so I was just doing some maintenance |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Currently, It takes the fast route when path string is represented as a OneByteString in V8.