`emplace_back` repeatedly-called is slower than preallocating the vector to the vocab size and directly inserting the data. Some rudimentary profiling with `chrono` improves the performance of this block of code from ~500us/op to ~40us/op. Overall, this slightly improves the sampling performance which has a more substantial impact for the `examples/lookahead` implementation -- I am able to see a ~10% performance boost in lookahead inference. |
||
|---|---|---|
| .. | ||
| cmake | ||
| base64.hpp | ||
| build-info.cpp.in | ||
| CMakeLists.txt | ||
| common.cpp | ||
| common.h | ||
| console.cpp | ||
| console.h | ||
| grammar-parser.cpp | ||
| grammar-parser.h | ||
| json-schema-to-grammar.cpp | ||
| json-schema-to-grammar.h | ||
| json.hpp | ||
| log.h | ||
| ngram-cache.cpp | ||
| ngram-cache.h | ||
| sampling.cpp | ||
| sampling.h | ||
| stb_image.h | ||
| train.cpp | ||
| train.h | ||