<commit_before><?php

require_once 'PowerProcess.class.php';

echo "----------Start----------\n";

$pp = new PowerProcess(10,10,false,'php://stdout');

$data = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);

while ($pp->RunControlCode()) {
	if (count($data) > 0) {
		// We have data to process
		if ($pp->SpawnReady()) {
			$pp->threadData = array_shift($data);
			if (!$pp->SpawnThread()) {
				$pp->Log("Error spawning thread");
				
				// Sleep just in case
				sleep(1);
				
				// Add the data back to the queue
				$data[] = $pp->threadData;
			}
		} else {
			$pp->Tick();
		}
	} else {
		// No more data to process
		$pp->Shutdown();
	}
}

if ($pp->RunThreadCode()) {
	$pp->Log("Processing: {$pp->threadData}");
	for ($i = 0; $i < $pp->threadData; $i++) {
		sleep(1);
		$pp->Log("Processed to {$i}");
	}
	exit(0);
}

echo "----------Stop-----------\n";

?><commit_msg>Removed Tick() from loop - No longer needed<commit_after><?php

require_once 'PowerProcess.class.php';

echo "----------Start----------\n";

$pp = new PowerProcess(10,10,false,'php://stdout');

$data = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);

while ($pp->RunControlCode()) {
	if (count($data) > 0) {
		// We have data to process
		if ($pp->SpawnReady()) {
			$pp->threadData = array_shift($data);
			if (!$pp->SpawnThread()) {
				$pp->Log("Error spawning thread");
				
				// Sleep just in case
				sleep(1);
				
				// Add the data back to the queue
				$data[] = $pp->threadData;
			}
		}
	} else {
		// No more data to process
		$pp->Shutdown();
	}
}

if ($pp->RunThreadCode()) {
	$pp->Log("Processing: {$pp->threadData}");
	for ($i = 0; $i < $pp->threadData; $i++) {
		sleep(1);
		$pp->Log("Processed to {$i}");
	}
	exit(0);
}

echo "----------Stop-----------\n";

?>
{'fraction_non_alphanumeric': 0.26640045636052484, 'fraction_numerical': 0.034227039361095266, 'mean_word_length': 2.708245243128964, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4395533', 'n_tokens_mistral': 766, 'n_tokens_neox': 678, 'n_words': 142}