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

Significantly improved addFile/changeFile/removeFile performance. #3726

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jfstephe
Copy link

@jfstephe jfstephe commented Nov 12, 2021

When running karma in watch mode, and multiple files change (triggered for example by this typescript compiler issue), then the total time for the change handlers to complete is VERY slow - 100ms approx, per file on my machine. When all the files in the project are touched this causes a massive delay on the test execution.

The performance issue seems to be related to a getter that takes a long time to run. I think this is only returning things for test purposes ATM, so this PR removes this.

@jfstephe
Copy link
Author

@googlebot - signed it!

@devoto13
Copy link
Collaborator

Thanks for the PR @jfstephe! The change looks very good 👍
While the return value is not used by karma core, it may still be used by some third-party plugins, so this PR will probably have to wait until we're ready to open master brach for breaking changes before the next major release.

As for the CLA, most likely it is failing because the commit and the signed CLA have different emails.

@jfstephe jfstephe force-pushed the fix-file-change-performance branch 2 times, most recently from 57740d6 to a58023e Compare November 15, 2021 09:24
Change to the event handlers so that they don't return the, generally unecessary, list of files which can save around 100ms per-event (depending on machine spec)

BREAKING CHANGE:

Core public API change: Handlers no longer return the list of files, and a separate call is now needed to return that information.
@jfstephe
Copy link
Author

@devoto13 - CLA corrected, along with the commit message format (I think!) :-).

Question: Can you give me an idea of typical time-scales for this being released? If it's more than a couple of weeks I'll publish this to our private npm locally, if not I'll wait for a while. Thanks!

@devoto13
Copy link
Collaborator

@jfstephe Thank you for fixing the issues!

I'm afraid it may take more than a couple of weeks before this gets released, so private package is probably the way to go. You should also be able to install your branch directly from GitHub using:

$ npm i jfstephe/karma#fix-file-change-performance

@jfstephe
Copy link
Author

Awesome, thanks!

@@ -172,18 +173,18 @@ class FileList {
const excluded = this._findExcluded(path)
if (excluded) {
log.debug(`Add file "${path}" ignored. Excluded by "${excluded}".`)
return this.files
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devoto13
I think not returning the file list is a breaking change. Should we not hold on to this change for release v7+ (#3503)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jginsburgn Yes, I think it should be better to land it in a major release.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@@ -114,6 +114,7 @@ class FileList {
return lastCompletedRefresh
}

// TODO - Change this so that it's not a getter. Getters shouldn't do lots of processing!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: TODO: instead of TODO - :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi - I really don't want to spend the 15 minutes on context switching to remove a '-'. Can this be accepted as is (assuming no other issues)?

@jfstephe
Copy link
Author

jfstephe commented May 6, 2022

Is this waiting on me for anything?

@devoto13
Copy link
Collaborator

devoto13 commented May 7, 2022

@jfstephe No, it's waiting until we have setup the branch for beta releases and then we'll merge. I'll fix the - before merging, so you don't need to bother with it.

@jfstephe
Copy link
Author

jfstephe commented May 5, 2023

@devoto13 - Hi, it's been almost a year on this. Any eta on this being merged?

@devoto13
Copy link
Collaborator

devoto13 commented May 5, 2023

@jfstephe I don't have permissions to merge, so without somebody from Google, there is nothing I can do. And given the recent karma deprecation announcement, I'm afraid that the most likely eta is never, sorry 😞

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

4 participants