Skip to content

Commit 3868667

Browse files
committed
Improve performance.
1 parent 730eea9 commit 3868667

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/DataSource/FileDataSource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class FileDataSource extends AbstractDataSource
3535
*
3636
* @throws DataSourceException
3737
*/
38-
public function __construct(string $filePath, int $bufferSize = 4096)
38+
public function __construct(string $filePath, int $bufferSize = 2048)
3939
{
4040
if (false === \file_exists($filePath)) {
4141
throw new DataSourceException('File does not exist: '.$filePath);

src/State/AbstractKeywordState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract class AbstractKeywordState implements StateInterface
1212
*/
1313
public function run(DataSourceInterface $dataSource)
1414
{
15-
$position = 0;
15+
$position = 1;
1616
$word = $this->getWord();
1717
$wordLength = \mb_strlen($word);
1818
while (null !== $char = $dataSource->read()) {

src/State/ValueState.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,12 @@ public function run(DataSourceInterface $dataSource)
3737
$state = States::$ARRAY;
3838
break;
3939
case 't':
40-
$dataSource->rewind();
4140
$state = States::$TRUE;
4241
break;
4342
case 'f':
44-
$dataSource->rewind();
4543
$state = States::$FALSE;
4644
break;
4745
case 'n':
48-
$dataSource->rewind();
4946
$state = States::$NULL;
5047
break;
5148
default:

0 commit comments

Comments
 (0)