From bf9c3b7c9c1f8e963a876e0149940a2e2de2977a Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:17:17 +0200 Subject: [PATCH] TASK: Revert PerformanceMeasurement adjustments we will open a dedicated pr to get rid of the forkCommandUseHere --- .../PerformanceMeasurementCommandController.php | 14 ++++++++++++++ .../Command/PerformanceMeasurementService.php | 11 ++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php index be846202a64..a34583a39e7 100644 --- a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php +++ b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php @@ -50,4 +50,18 @@ public function preparePerformanceTestCommand(int $nodesPerLevel, int $levels): fn() => $this->performanceMeasurementService->createNodesForPerformanceTest($nodesPerLevel, $levels) ); } + + /** + * Test the performance of forking a content stream and measure the time taken. + * + * @internal + */ + public function testPerformanceCommand(): void + { + $time = microtime(true); + $this->performanceMeasurementService->forkContentStream(); + + $timeElapsed = microtime(true) - $time; + $this->outputLine('Time: ' . $timeElapsed); + } } diff --git a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php index 13a263febe1..cc67508bade 100644 --- a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php +++ b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php @@ -26,6 +26,7 @@ use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceInterface; use Neos\ContentRepository\Core\Feature\Common\InterdimensionalSiblings; use Neos\ContentRepository\Core\Feature\ContentStreamEventStreamName; +use Neos\ContentRepository\Core\Feature\ContentStreamForking\Command\ForkContentStream; use Neos\ContentRepository\Core\Feature\NodeCreation\Event\NodeAggregateWithNodeWasCreated; use Neos\ContentRepository\Core\Feature\NodeModification\Dto\SerializedPropertyValues; use Neos\ContentRepository\Core\Feature\RootNodeCreation\Event\RootNodeAggregateWithNodeWasCreated; @@ -107,6 +108,7 @@ public function createNodesForPerformanceTest(int $nodesPerLevel, int $levels): ExpectedVersion::ANY() )); echo $sumSoFar; + #$this->outputLine(microtime(true) - $time . ' elapsed'); } @@ -152,10 +154,9 @@ private function createHierarchy( public function forkContentStream(): void { - throw new \BadMethodCallException('not implemented'); - // $this->contentRepository->handle(ForkContentStream::create( - // ContentStreamId::create(), - // $this->contentStreamId, - // )); + $this->contentRepository->handle(ForkContentStream::create( + ContentStreamId::create(), + $this->contentStreamId, + )); } }