Merged
Conversation
Contributor
Author
|
我在对付unit test |
Contributor
Author
<?php
use Overtrue\Pinyin\Pinyin;
require 'src/DictLoaderInterface.php';
require 'src/FileDictLoader.php';
require 'src/Pinyin.php';
$str = '世界互联网大会开幕 习近平发表视频讲话
[乌镇三年:见证互联网时代的“蝶变之路” 互联网大会专题]
李克强:以改革开放创新推动中国经济向好
“百名红通人员”头号嫌犯杨秀珠回国自首
[现场 高清图 起底杨秀珠:用卡车给领导送礼 杨秀珠投案历程]
韩检方:拖延越底线 最迟18日调查朴槿惠
[韩青瓦台:朴槿惠不会主动下台 崔顺实侄女涉嫌介入平昌冬奥]
知音传媒集团原党委书记胡勋璧被开除党籍
[退休后违规在原企业任职并领取薪酬 与他人发生不正当性关系 ]
央视曝光快递乱象:分拣员拆开包裹偷吃偷拿
梁颂恒游蕙桢办公室被曝互打通 内有酒水纳粹书
台媒称歼10C批量交付解放军 具特殊隐形能力不输F22
歼20身披割裂式迷彩试飞 低空掠过屋顶场面震撼(图)
媒体:人民日报头版这篇重磅文章 很有意味
复旦学者:55岁60岁退休太早 人力资源浪费严重
航拍内地学府第三期:杀进世界500强的平民学校
希拉里大选前疑和克林顿大吵 气得克林顿摔手机
夫妻为参不参加同学会吵翻 女儿走失1天没发现
小伙嫌婚房小殴打凑钱父母:我在老婆面前没面子
瑞典名厨因长得像特朗普 遭3名陌生人痛殴(图)
长沙警察被曝殴打并威胁医务人员 警方回应 法院频道
湖南一民警被曝医闹殴打医护人员 已被停职
油价迎来年内最大降幅 加满一箱油能省15元
乐视旗下美国汽车项目停产 美官员称其为“旁氏骗局”
小马云被他人利用直播 直播者:我没炒作';
$pinyin = new pinyin(null, false);
$s = microtime(true);
for($i = 0; $i < 10; $i++)
$pinyin->sentence($str);
echo microtime(true) - $s. "\n";
$pinyin = new pinyin(null, true);
$s = microtime(true);
for($i = 0; $i < 10; $i++)
$pinyin->sentence($str);
echo microtime(true) - $s . "\n";6-8倍性能提升 |
Owner
|
@garveen 当时是考虑到内存原因才做成分片的,不然一个文件一次 load 就好了。 |
Contributor
Author
|
@overtrue 我知道这是个 trade off,也在群里讲了,然而我觉得应该提供个开关供大批量使用 |
Owner
|
@garveen 所以我弄了一个 interface... 要不你新建一个 loader 吧 |
overtrue
reviewed
Nov 17, 2016
| * @param mixed $loader | ||
| */ | ||
| public function __construct(DictLoaderInterface $loader = null) | ||
| public function __construct($loader = null) |
Owner
There was a problem hiding this comment.
可以考虑给默认值为 Overtrue\Pinyin\FileDictLoader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.