mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-07 09:25:33 +00:00
Fixes #9154. Improves performance in both kmcmplib and in kmc-kmn/kmw-compiler. After these changes are applied, vietnamese_telex keyboard builds in around 6 seconds on my machine (down from over 2 minutes). This is certainly only the surface of performance improvements we could make. Addresses excessive memory reallocations in kmcmplib, by reallocating store and key arrays in large chunks of 100 items rather than reallocating on each new item added. This resulted in a 250x speed-up on functions such as `AddStore` in WASM build. Some careful modulus arithmetic was needed for resizing the key array, which can be grown in larger increments. Resolved excessive zeroing out of destination buffer in u16ncpy, which was being called with an 8kb destination buffer on every line of the file. In the kmw side, vast majority of the performance cost was in copying of buffers while loading a .kmx into memory, rather than creating views into the memory. Essentially replaced this pattern: ``` return this.rString.fromBuffer(source.slice(offset)); ``` with: ``` const data = new Uint8Array(source.buffer, source.byteOffset + offset); return this.rString.fromBuffer(data); ``` |
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| build.sh | ||