Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of N-best generation in dictionary predictor.
A heap is constructed on std::vector<Result> but Result is now not so cheap for swapping. This CL constructs a heap by using std::vector<const Result *> to improve performance. name old cpu/op new cpu/op delta BM_MobileOneCharacterPrediction 51.6ms ± 5% 49.2ms ± 4% -4.61% (p=0.000 n=48+54) BM_MobileOneCharacterSuggestion 49.1ms ± 5% 47.1ms ± 5% -4.10% (p=0.000 n=49+60) BM_MobileOneCharacterAmbiguousPrediction 51.8ms ± 5% 49.3ms ± 6% -4.84% (p=0.000 n=49+59) BM_MobileOneCharacterAmbiguousSuggestion 49.4ms ± 7% 47.1ms ± 6% -4.68% (p=0.000 n=48+57) BM_DesktopAnthyCorpusConversion 19.9s ± 1% 20.4s ± 3% +2.34% (p=0.016 n=5+4) BM_MobileAnthyCorpusConversion 18.1s ± 2% 18.2s ± 1% ~ (p=0.690 n=5+5) BM_DesktopStationPredictionCorpusPrediction 5.82s ± 2% 6.04s ± 4% +3.75% (p=0.032 n=5+4) BM_MobileStationPredictionCorpusPrediction 48.2s ± 0% 48.7s ± 0% +1.11% (p=0.008 n=5+5) BM_DesktopStationPredictionCorpusSuggestion 4.08s ± 0% 4.22s ± 3% +3.22% (p=0.029 n=4+4) BM_MobileStationPredictionCorpusSuggestion 42.4s ± 2% 42.8s ± 2% ~ (p=0.151 n=5+5) name old time/op new time/op delta BM_MobileOneCharacterPrediction 51.6ms ± 5% 49.2ms ± 4% -4.60% (p=0.000 n=48+54) BM_MobileOneCharacterSuggestion 49.1ms ± 5% 47.1ms ± 5% -4.13% (p=0.000 n=49+60) BM_MobileOneCharacterAmbiguousPrediction 51.9ms ± 5% 49.4ms ± 6% -4.85% (p=0.000 n=49+59) BM_MobileOneCharacterAmbiguousSuggestion 49.4ms ± 7% 47.1ms ± 6% -4.72% (p=0.000 n=48+57) BM_DesktopAnthyCorpusConversion 19.9s ± 1% 20.4s ± 3% +2.33% (p=0.032 n=5+4) BM_MobileAnthyCorpusConversion 18.1s ± 2% 18.2s ± 1% ~ (p=0.690 n=5+5) BM_DesktopStationPredictionCorpusPrediction 5.82s ± 2% 6.04s ± 4% +3.76% (p=0.032 n=5+4) BM_MobileStationPredictionCorpusPrediction 48.2s ± 0% 48.7s ± 0% +1.14% (p=0.008 n=5+5) BM_DesktopStationPredictionCorpusSuggestion 4.14s ± 5% 4.22s ± 3% ~ (p=0.111 n=5+4) BM_MobileStationPredictionCorpusSuggestion 42.4s ± 1% 42.8s ± 2% ~ (p=0.151 n=5+5) name old allocs/op new allocs/op delta BM_MobileOneCharacterPrediction 60.8k ± 0% 60.8k ± 0% +0.08% (p=0.000 n=59+55) BM_MobileOneCharacterSuggestion 52.6k ± 0% 52.7k ± 0% +0.09% (p=0.000 n=59+60) BM_MobileOneCharacterAmbiguousPrediction 60.8k ± 0% 60.8k ± 0% +0.08% (p=0.000 n=60+60) BM_MobileOneCharacterAmbiguousSuggestion 52.6k ± 0% 52.7k ± 0% +0.09% (p=0.000 n=60+57) BM_DesktopAnthyCorpusConversion 22.0M ± 0% 22.0M ± 0% ~ (p=0.444 n=5+5) BM_MobileAnthyCorpusConversion 22.4M ± 0% 22.4M ± 0% ~ (all samples are equal) BM_DesktopStationPredictionCorpusPrediction 5.43M ± 0% 5.45M ± 0% +0.33% (p=0.008 n=5+5) BM_MobileStationPredictionCorpusPrediction 38.8M ± 0% 38.8M ± 0% +0.05% (p=0.029 n=4+4) BM_DesktopStationPredictionCorpusSuggestion 1.87M ± 0% 1.88M ± 0% +0.97% (p=0.008 n=5+5) BM_MobileStationPredictionCorpusSuggestion 27.4M ± 0% 27.4M ± 0% +0.07% (p=0.008 n=5+5) name old peak-mem(Bytes)/op new peak-mem(Bytes)/op delta BM_MobileOneCharacterPrediction 928k ± 0% 928k ± 0% ~ (all samples are equal) BM_MobileOneCharacterSuggestion 921k ± 0% 921k ± 0% ~ (all samples are equal) BM_MobileOneCharacterAmbiguousPrediction 928k ± 0% 928k ± 0% ~ (all samples are equal) BM_MobileOneCharacterAmbiguousSuggestion 921k ± 0% 921k ± 0% ~ (all samples are equal) BM_DesktopAnthyCorpusConversion 1.64M ± 0% 1.64M ± 0% ~ (p=0.444 n=5+5) BM_MobileAnthyCorpusConversion 1.42M ± 0% 1.42M ± 0% ~ (all samples are equal) BM_DesktopStationPredictionCorpusPrediction 1.35M ± 0% 1.35M ± 0% ~ (all samples are equal) BM_MobileStationPredictionCorpusPrediction 2.21M ± 0% 2.21M ± 0% ~ (all samples are equal) BM_DesktopStationPredictionCorpusSuggestion 648k ± 0% 648k ± 0% ~ (all samples are equal) BM_MobileStationPredictionCorpusSuggestion 1.31M ± 0% 1.31M ± 0% ~ (p=0.444 n=5+5) PiperOrigin-RevId: 543656867
- Loading branch information