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

perf: Use only one ps exec to find a Chromium browser opened on Mac OS #10588

Merged
merged 2 commits into from Nov 2, 2022
Merged

perf: Use only one ps exec to find a Chromium browser opened on Mac OS #10588

merged 2 commits into from Nov 2, 2022

Conversation

ArnaudBarre
Copy link
Member

Description

See #10485 (comment)

Additional context

After a quick benchmark I saw that adding a grep was not making things faster

Script
import { execSync } from "node:child_process";

const supportedChromiumBrowsers = [
  "Google Chrome Canary",
  "Google Chrome Dev",
  "Google Chrome Beta",
  "Google Chrome",
  "Microsoft Edge",
  "Brave Browser",
  "Vivaldi",
  "Chromium",
];

const start = performance.now();
for (let i = 0; i < 100; i++) {
  const ps = execSync("ps cax").toString();
  const browser = supportedChromiumBrowsers.find((b) => ps.includes(b));
}
console.log(`no grep: ${(performance.now() - start).toFixed(2)}ms`);

const start2 = performance.now();
for (let i = 0; i < 100; i++) {
  const ps = execSync(
    `ps cax | grep "${supportedChromiumBrowsers.join("\\|")}"`,
  ).toString();
  const browser = supportedChromiumBrowsers.find((b) => ps.includes(b));
}
console.log(`grep: ${(performance.now() - start2).toFixed(2)}ms`);

Also the tab is now reused is the request browser is chromium based

@ArnaudBarre ArnaudBarre changed the title perf: Use only one ps exec to find a Chromium browser opened on Max OS perf: Use only one ps exec to find a Chromium browser opened on Mac OS Oct 21, 2022
@ArnaudBarre
Copy link
Member Author

If the node16 test known to be flacky or is it a regression?

@patak-dev
Copy link
Member

It is a flaky test, it got a lost worse in the past week

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

Successfully merging this pull request may close these issues.

None yet

3 participants