Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: only save files if they are unchanged#417

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
RyanZim merged 1 commit intopostcss:masterfromkentcdodds:kent/unchanged-support
Dec 10, 2021

Conversation

kentcdodds
Copy link
Contributor

Closes#320

This also solves a significant annoyance for anyone using postcss with an app that rebuilds on file change:remix-run/remix#714

rkusa, MichaelDeBoey, aganoza, and mnlfischer reacted with thumbs up emojimcansh, rkusa, MichaelDeBoey, mnlfischer, and argyleink reacted with hooray emoji
@RyanZim
Copy link
Collaborator

Hey, code looks good; my only concern is performance. Has any testing been done on this?

@kentcdodds
Copy link
ContributorAuthor

kentcdodds commentedNov 30, 2021
edited
Loading

Just did some testing here:

constfs=require("fs-extra");asyncfunctiononeFile(){console.time("one file");awaitfs.readFile("./files/01.css");console.timeEnd("one file");}asyncfunctionhundredFiles(){console.time("100 files");for(leti=0;i<100;i++){awaitfs.readFile(`./files/01 copy${i}.css`);}console.timeEnd("100 files");}oneFile();hundredFiles();

Those css files areeach 111kb of this copy/pasted over and over:

body {color: red;}

My output (on my fast machine) is:

one file: 0.557ms100 files: 15.627ms

It's pretty darn fast. Feel free to watch for yourself (I'm live streaming right now):https://www.youtube.com/watch?v=KPKBUBchCVo

So I think this is fine. Though if you'd like to add an opt-out option then I could do that. But I kinda think that should be some added complexity that we should add only if necessary since this doesn't seem to be much of a problem.

mnlfischer and aganoza reacted with thumbs up emoji

@kentcdodds
Copy link
ContributorAuthor

Ping? 😅

@RyanZim
Copy link
Collaborator

Hey, sorry for the slowness here; didn't want to merge until I had spare time to publish a new version.

@RyanZimRyanZim merged commitb06fa80 intopostcss:masterDec 10, 2021
@kentcdoddskentcdodds deleted the kent/unchanged-support branchDecember 10, 2021 21:08
@kentcdodds
Copy link
ContributorAuthor

No worries. I know life is busy 😅 Thanks for merging and releasing this!

@chillitom
Copy link

could comparing files sizes first and only reading/comparing if different give a small perf improvement?

@kentcdodds
Copy link
ContributorAuthor

I expect it could, but it's it really worth the added complexity? For most cases it doesn't even take a full millisecond to just read and compare. It probably wouldn't make much of a difference...

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Skip file write if file content isn't changed
3 participants
@kentcdodds@RyanZim@chillitom

[8]ページ先頭

©2009-2025 Movatter.jp