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 (#312)
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