diff --git a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php deleted file mode 100644 index a34583a39e7..00000000000 --- a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementCommandController.php +++ /dev/null @@ -1,67 +0,0 @@ -performanceMeasurementService = $contentRepositoryRegistry->buildService( - ContentRepositoryId::fromString('default'), - $performanceMeasurementServiceFactory - ); - - parent::__construct(); - } - - /** - * Prepare the performance test by removing existing data and creating nodes for the test. - * - * @param int $nodesPerLevel The number of nodes to create per level. - * @param int $levels The number of levels in the node tree. - * @internal - */ - public function preparePerformanceTestCommand(int $nodesPerLevel, int $levels): void - { - $this->performanceMeasurementService->removeEverything(); - $this->outputLine("All removed. Starting to fill."); - GraphProjectorCatchUpHookForCacheFlushing::disabled( - 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 deleted file mode 100644 index cc67508bade..00000000000 --- a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementService.php +++ /dev/null @@ -1,162 +0,0 @@ -contentStreamId = contentStreamId::fromString('cs-identifier'); - $this->workspaceName = WorkspaceName::fromString('some-workspace'); - $this->dimensionSpacePoints = new DimensionSpacePointSet([ - DimensionSpacePoint::fromArray(['language' => 'mul']), - DimensionSpacePoint::fromArray(['language' => 'de']), - DimensionSpacePoint::fromArray(['language' => 'gsw']), - DimensionSpacePoint::fromArray(['language' => 'en']), - DimensionSpacePoint::fromArray(['language' => 'fr']) - ]); - - $this->contentStreamEventStream = ContentStreamEventStreamName::fromContentStreamId( - $this->contentStreamId - ); - } - - public function removeEverything(): void - { - $eventTableName = DoctrineEventStoreFactory::databaseTableName($this->contentRepositoryId); - $this->connection->executeStatement('TRUNCATE ' . $this->connection->quoteIdentifier($eventTableName)); - $this->contentRepository->resetProjectionStates(); - } - - public function createNodesForPerformanceTest(int $nodesPerLevel, int $levels): void - { - $this->contentRepository->handle(CreateRootWorkspace::create( - WorkspaceName::forLive(), - $this->contentStreamId - )); - - $rootNodeAggregateId = nodeAggregateId::fromString('lady-eleonode-rootford'); - $rootNodeAggregateWasCreated = new RootNodeAggregateWithNodeWasCreated( - $this->workspaceName, - $this->contentStreamId, - $rootNodeAggregateId, - NodeTypeName::fromString('Neos.ContentRepository:Root'), - $this->dimensionSpacePoints, - NodeAggregateClassification::CLASSIFICATION_ROOT, - ); - - $this->eventPersister->publishEvents($this->contentRepository, new EventsToPublish( - $this->contentStreamEventStream->getEventStreamName(), - Events::with($rootNodeAggregateWasCreated), - ExpectedVersion::ANY() - )); - - #$time = microtime(true); - $sumSoFar = 0; - $events = []; - $this->createHierarchy($rootNodeAggregateId, 1, $levels, $nodesPerLevel, $sumSoFar, $events); - $this->eventPersister->publishEvents($this->contentRepository, new EventsToPublish( - $this->contentStreamEventStream->getEventStreamName(), - Events::fromArray($events), - ExpectedVersion::ANY() - )); - echo $sumSoFar; - #$this->outputLine(microtime(true) - $time . ' elapsed'); - } - - - /** - * @throws \Throwable - * @param array $events - */ - private function createHierarchy( - nodeAggregateId $parentNodeAggregateId, - int $currentLevel, - int $maximumLevel, - int $numberOfNodes, - int &$sumSoFar, - array &$events, - ): void { - if ($currentLevel <= $maximumLevel) { - for ($i = 0; $i < $numberOfNodes; $i++) { - $nodeAggregateId = nodeAggregateId::create(); - $events[] = new NodeAggregateWithNodeWasCreated( - $this->workspaceName, - $this->contentStreamId, - $nodeAggregateId, - NodeTypeName::fromString('Neos.ContentRepository:Testing'), - OriginDimensionSpacePoint::fromArray(['language' => 'mul']), - InterdimensionalSiblings::fromDimensionSpacePointSetWithoutSucceedingSiblings($this->dimensionSpacePoints), - $parentNodeAggregateId, - null, - SerializedPropertyValues::createEmpty(), - NodeAggregateClassification::CLASSIFICATION_REGULAR, - ); - $sumSoFar++; - $this->createHierarchy( - $nodeAggregateId, - $currentLevel + 1, - $maximumLevel, - $numberOfNodes, - $sumSoFar, - $events - ); - } - } - } - - public function forkContentStream(): void - { - $this->contentRepository->handle(ForkContentStream::create( - ContentStreamId::create(), - $this->contentStreamId, - )); - } -} diff --git a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementServiceFactory.php b/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementServiceFactory.php deleted file mode 100644 index 1b3c9611228..00000000000 --- a/Neos.ContentRepository.BehavioralTests/Classes/Command/PerformanceMeasurementServiceFactory.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @internal - */ -class PerformanceMeasurementServiceFactory implements ContentRepositoryServiceFactoryInterface -{ - public function __construct( - private readonly Connection $connection, - ) { - } - - public function build( - ContentRepositoryServiceFactoryDependencies $serviceFactoryDependencies - ): PerformanceMeasurementService { - return new PerformanceMeasurementService( - $serviceFactoryDependencies->eventPersister, - $serviceFactoryDependencies->contentRepository, - $this->connection, - $serviceFactoryDependencies->contentRepositoryId - ); - } -}