overtrue/pinyin
Convert Chinese characters to Pinyin in PHP/Laravel. overtrue/pinyin supports full pinyin, initials, tone options, segmentation, and custom dictionaries—ideal for search indexing, sorting, slugs, and transliteration in web apps.
php benchmark/run.php
这个表格对比了三种转换策略的性能:
Method Memory Cached Smart Fastest Speedup
sentence 20.5 ms 8.2 ms 12.3 ms Cached 2.5x
fullSentence 18.3 ms 7.5 ms 11.2 ms Cached 2.4x
...
────────────────────────────────────────────────
TOTAL 190.26ms 119.33ms 194.38ms Cached 1.6x
性能总结部分提供了策略之间的直观对比:
📊 Performance Summary:
• Cached strategy is 1.59x faster than Memory Optimized
• Smart strategy is 0.98x faster than Memory, 1.63x slower than Cached
这让您可以快速了解:
显示每种策略的内存使用情况:
Strategy Peak Memory Description
Memory Optimized 2.5 MB Minimal memory, loads on demand
Cached 15.8 MB All data cached, fastest repeated access
Smart 8.2 MB Adaptive loading based on text complexity
选择合适的策略:
Speedup 值的含义:
TOTAL 行的重要性:
How can I help you explore Laravel packages today?