Closed chenglou closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
web-gpt | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 22, 2023 5:03am |
@0hq imma leave this as reference but close it!
Profiler shows that the next bottleneck is in selectTopK, specifically the sorting, since GPT2 mode would make you sort 50k floats each time
The sorting function is O(nlogn). This converts it to O(n) using quickselect instead of the JS engine's sort (e.g. quicksort), since we don't need the entire array sorted (just the top k)
But really, since this only represents 10% of the bottleneck in the screenshot, and log_2(50000) is only 15, this isn't worth it. The code gets complex for no good reason.
(Anonymous being the sort callback)