php-edifact / edifact

Tools to process EDI messages in UN/EDIFACT format
GNU Lesser General Public License v3.0
274 stars 87 forks source link

update to php7+ v2 #89

Closed voku closed 5 years ago

voku commented 5 years ago

[+]: "Parser" -> ~ 50% better parse performance [+]: use php7 parameter type hints

*: add ".editorconfig" -> same base config in vim, PhpStorm, ... *: add ".gitattributes" -> exclude some files, if you install the package via composer

sabas commented 5 years ago

Wow, the performance increase is due to the type hinting or something else? Let me know if it's complete for merging...

voku commented 5 years ago

Noop the performance improvements comes more from reducing function & regex calls and by using strpos (https://stackoverflow.com/a/29728934/1155858) ...

e.g.:

from:

 $str = \strrev(
     \preg_replace(
         self::$DELIMITER . $this->symbEnd . self::$DELIMITER,
         "",
         \strrev($str),
         1
     )
 )        

to:

 $str = \preg_replace(
     self::$DELIMITER . $this->symbEnd . '$' . self::$DELIMITER,
     '',
     $str
 );

PS: for php 7.0 I think the type hints has a small negative performance effect, but a very small and it's optimized in php >= 7.1

voku commented 5 years ago

PS: if you merge this changes, can you also add a new git tag, otherwise my IDE complains about the dev-master in my "composer.json" file, thanks :)

PS2: can you also take a look at https://travis-ci.com/php-edifact/edifact/ and register this package, so that it will be automatically tested with PHP 7.x, thanks again :)

sabas commented 5 years ago

For the Travis, I wrote a ticket because I messed up the set up... I will push a tag asap

sabas commented 5 years ago

@voku travis is failing, can you help me to understand why? https://travis-ci.com/php-edifact/edifact/jobs/163970530