-
Notifications
You must be signed in to change notification settings - Fork 59
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
#24 rename package to roave/backward-compatibility-check
#50
Merged
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
96586a9
#24 renamed package to `roave/backward-compatibility-check`
Ocramius e119e62
#24 renamed `Roave\ApiCompare\Comparator\BackwardsCompatibility` to `…
Ocramius 62eeb33
#24 renamed all `compare()` methods on all BC break detectors to just…
Ocramius 4ead51c
#24 renamed `Changes::new()` to `Changes::empty()`
Ocramius 2bca1ac
#24 minor performance optimisation: if `Changes#mergeWith()` is merge…
Ocramius ecd9ed9
#24 removed `Changes#withAddedChange()`, as `mergeWith` is the prefer…
Ocramius b416323
#24 renamed `Changes::fromArray()` in favour of `Changes::fromList()`…
Ocramius d59ee07
#24 avoid greedy usage of `array_merge()` where a splat operator woul…
Ocramius 4c4ba88
#24 performance/memory optimisation: avoid trashing memory with `Chan…
Ocramius 692de1d
#24 corrected `exclude-pattern` entries in the phpcs config (forgot a…
Ocramius 9c0053b
#24 verifying that `Changes#mergeWith()` avoids copy-on-write when an…
Ocramius ef30d0b
#24 changed command name and description
Ocramius fb19272
#24 renamed command class to match command name
Ocramius 9e897d1
#24 using `1` as exit code for failed checks - exit code `2` is reser…
Ocramius ba589c2
#24 renamed package from `Roave\ApiCompare` to `Roave\BackwardCompati…
Ocramius c7f98d8
#24 added binary to composer binary paths
Ocramius 4f95a2c
#24 added BC verification to the travis build
Ocramius 2dcfd7f
#24 added a success/failure message at the end of the execution of th…
Ocramius e539096
#24 improved CLI command documentation by dcumenting all options
Ocramius 2c8fe42
#24 moved most docs to the CLI command itself: `--help` is our friend!
Ocramius ea02a5d
#24 using exit code `3` instead of `1` for when BC breaks are detected
Ocramius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
#24 performance/memory optimisation: avoid trashing memory with `Chan…
…ges::empty()`
- Loading branch information
commit 4c4ba887d03f478639af927b743608176a5fd076
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,25 @@ | |
final class Changes implements IteratorAggregate, Countable | ||
{ | ||
/** @var Change[] */ | ||
private $changes = []; | ||
private $changes; | ||
|
||
private function __construct() | ||
{ | ||
} | ||
|
||
public static function empty() : self | ||
{ | ||
return new self(); | ||
static $empty; | ||
|
||
if ($empty) { | ||
return $empty; | ||
} | ||
|
||
$empty = new self(); | ||
|
||
$empty->changes = []; | ||
|
||
return $empty; | ||
} | ||
|
||
public static function fromList(Change ...$changes) : self | ||
|
@@ -36,7 +46,7 @@ public static function fromList(Change ...$changes) : self | |
|
||
public function mergeWith(self $other) : self | ||
{ | ||
if (empty($other->changes)) { | ||
if (! $other->changes) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looked useless at first, but saves us from loads of instantiations |
||
return $this; | ||
} | ||
|
||
|
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.
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.
I found (via
Kcachegrind
) that this was really trashing memory and CPU on this side (together withfromArray()
andmergeWith()
)