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

Optimize record/replay bytecodes #4

Closed
bhackett1024 opened this issue Apr 28, 2021 · 1 comment
Closed

Optimize record/replay bytecodes #4

bhackett1024 opened this issue Apr 28, 2021 · 1 comment
Assignees

Comments

@bhackett1024
Copy link

The record/replay bytecodes (RecordReplayIncExecutionProgressCounter and RecordReplayInstrumentation[Generator]) are always compiled into calls into the runtime. On the simple benchmark below this leads to a 20x overhead when recording (30ms) vs. not recording (700ms). On gecko, where we optimize these bytecodes, the overhead is much less (65ms vs 75ms). We need to optimize how these bytecodes are compiled to avoid degrading JS performance excessively.

function foo() {
  const arr = [];
  for (let i = 0; i < 2000000; i++) {
    arr.push(i);
    arr.push(i + 1);
    arr.push(i + 2);
    arr.push(i + 3);
    arr.pop();
    arr.pop();
    arr.pop();
  }
}
@bhackett1024
Copy link
Author

This is in a pretty good place for now. We still aren't optimizing calls to the runtime methods --- I haven't found anything in V8 comparable that we can crib from and I'm trying to avoid changing too much inside V8 until things are pretty stable (especially after dealing with #6). The implementations for these methods are much simpler now however, and we aren't emitting instrumentation opcodes when recording. These bring the time taken by chromium on the above benchmark to 50ms, less than 2x overhead vs. not recording.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant