-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(d1): optimize interrupt vectoring by indexing
Currently, the interrupt vector dispatch code uses a linear search over the interrupt vector array by checking each vector's ID against the interrupt number being dispatched. This is inefficient; because we already generate the vector array in order, we can simply index into it, which is _O_(1) instead of _O_(_n<sub>interrupts</sub>_). This commit changes the existing code to do that. We can rely on the ordering being correct as it's generated by a `const fn` that should always output the same order. However, I've also added debug assertions that the index and ID match, just in case the table somehow gets corrupted or something. I don't think this is really that necessary, but it seemed nice to have.
- Loading branch information
Showing
1 changed file
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters