Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: stop copying code cache, part 2 #47958

Merged
merged 1 commit into from
May 15, 2023

Commits on May 11, 2023

  1. src: stop copying code cache, part 2

    This removes more copies of the code cache data.
    
    First: for the builtin snapshot, we were copying the code cache to
    create a `std::vector<uint8_t>`. This was slowing down static
    intialization. Change it to use a good old `uint8_t*` and `size_t`
    rather than a vector. For the case of embedder provided snapshots, we
    also add an `owning_ptr` so that we can properly cleanup owned values
    created from the snapshot.
    
    Second: whenever the code cache was hit, we would remove the bytecode
    from the code cache, and then reserialize it from the compiled function.
    This was pretty slow. Change the code so that we can reuse the same code
    cache multiple times. If the code cache is rejected (say, because the
    user added V8 options), then we need to generate the bytecode, in which
    case we again use `owning_ptr` to ensure that the underlying code cache
    is freed.
    
    Combined, these changes improve the misc/startup.js benchmarks
    significantly (p < 0.001):
    
    * process,benchmark/fixtures/require-builtins: 22.15%
    * process,test/fixtures/semicolon: 8.55%
    * worker,benchmark/fixtures/require-builtins: 26.52%
    * worker,test/fixtures/semicolon: 21.52%
    kvakil committed May 11, 2023
    Configuration menu
    Copy the full SHA
    b43e828 View commit details
    Browse the repository at this point in the history