fukuball / jieba-php

"結巴"中文分詞:做最好的 PHP 中文分詞、中文斷詞組件。 / "Jieba" (Chinese for "to stutter") Chinese text segmentation: built to be the best PHP Chinese word segmentation module.
http://jieba-php.fukuball.com
MIT License
1.32k stars 260 forks source link

array_push is too slow #57

Closed Yahasana closed 5 years ago

Yahasana commented 5 years ago

It says in the documentation

If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.

codecov-io commented 5 years ago

Codecov Report

Merging #57 into master will increase coverage by 0.24%. The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #57      +/-   ##
============================================
+ Coverage     55.22%   55.47%   +0.24%     
  Complexity      268      268              
============================================
  Files             5        5              
  Lines          1157     1141      -16     
============================================
- Hits            639      633       -6     
+ Misses          518      508      -10
Impacted Files Coverage Δ Complexity Δ
src/class/JiebaAnalyse.php 77.04% <0%> (ø) 17 <0> (ø) :arrow_down:
src/class/JiebaCache.php 0% <0%> (ø) 59 <0> (ø) :arrow_down:
src/class/Posseg.php 71.11% <47.91%> (+1.62%) 78 <15> (ø) :arrow_down:
src/class/Jieba.php 77.13% <75%> (ø) 91 <0> (ø) :arrow_down:
src/class/Finalseg.php 99.09% <85.71%> (ø) 23 <0> (ø) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d17ed14...e374cfb. Read the comment docs.

fukuball commented 5 years ago

@Yahasana You are right, thanks!