-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Create SimpleFile only when writing the content #19493
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
juliusknorr
reviewed
Feb 18, 2020
juliusknorr
approved these changes
Feb 18, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one 👍 Just a small comment, but nothing necessary.
kesselb
reviewed
Feb 18, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
all done |
blizzz
approved these changes
Feb 25, 2020
blizzz
added
4. to release
Ready to be released and/or waiting for tests to finish
and removed
3. to review
Waiting for reviews
labels
Feb 25, 2020
test behavior, not implementation Signed-off-by: Robin Appelman <robin@icewind.nl>
instead of first creating an empty file and then writing the content. This solves the overhead of creating an empty file with the common pattern: ```php $file = $simpleFilder->newFile('foo.txt'); $file->putContent('bar.txt'); ``` roughly halving the number of storage and database operations that need to be done when creating a `SimpleFile`. This is not automatically done with `File` because that has a more complex api which I'm more hesitant to touch. Instead the `Folder::newFile` api has been extended to accept the content for the new file. In my local testing, the overhead of first creating an empty file took about 20% of the time for preview generation Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
rullzer
force-pushed
the
simplefile-new-lazy
branch
from
February 28, 2020 11:55
1125133
to
245125d
Compare
rebased and bumped autoloader |
Regressions:
|
nickvergessen
added a commit
that referenced
this pull request
Mar 24, 2020
Since #19493 newFile() by default does not write the file anymore. Setting an empty string as content will make it write the file immediate, without having to call putContent() afterwards. Signed-off-by: Joas Schilling <coding@schilljs.com>
ChristophWurst
added
the
pending documentation
This pull request needs an associated documentation update
label
Mar 30, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
4. to release
Ready to be released and/or waiting for tests to finish
pending documentation
This pull request needs an associated documentation update
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
instead of first creating an empty file and then writing the content.
This solves the overhead of creating an empty file with the common pattern:
roughly halving the number of storage and database operations that need to be done when creating a
SimpleFile
.This is not automatically done with
File
because that has a more complex api which I'm more hesitant to touch.Instead the
Folder::newFile
api has been extended to accept the content for the new file.In my local testing, the overhead of first creating an empty file took about 20% of the time for preview generation