Conversation
- Reduced redundant calculations and memory accesses in loops. - Applied `restrict`, `const`, and `inline` to improve compiler optimizations. - Optimized `VirtualMapL` and `VirtualMapRegionByLength` by minimizing repeated pointer arithmetic and avoiding unnecessary operations. - Improved clarity and efficiency of critical page mapping routines. These changes target hot paths in the paging system to enhance overall performance. Signed-off-by: Agustin Gutierrez <gutierrezaverruz0@hotmail.com>
- Reduced redundant pointer dereferencing and atomic reads. - Improved task selection loop efficiency. - Clarified and grouped context switch steps to enhance performance and maintainability. - Minimized unnecessary memory operations and improved code readability. These changes aim to streamline the core tasking logic and improve overall scheduler responsiveness. Signed-off-by: Agustin Gutierrez <gutierrezaverruz0@hotmail.com>
- Reduced repeated calculations inside loops. - Applied pointer arithmetic for faster pixel access and memory writes. These improvements enhance the efficiency of rectangle drawing and related framebuffer operations. Signed-off-by: Agustin Gutierrez <gutierrezaverruz0@hotmail.com>
|
Greetings, Regards, |
|
Hi, thanks for your response. The code was mostly generated based on suggestions from Microsoft Copilot after analyzing multiple source files. I really don't know about const. The performance gains from this patch are minor. The most noticeable improvement likely comes from removing the redundant if (length == 0) return;, which avoids unnecessary calculations in some edge cases. That said, modern compilers like GCC and Clang often detect simple addition patterns inside loops and apply optimizations such as strength reduction or even auto-vectorization. Because of this, some of the manual changes (like avoiding multiplications) may already be handled automatically during compilation. If you're asking for my opinion, I’d keep the paging: Optimize memory code for performance patch but with slight adjustments—for example, removing const and restrict to stay consistent with the existing code style and design philosophy. |
|
Where in the codebase is it attempted to use the lowest level page map function with a length of 0? The if check is unnecessary and I’d be surprised if it hits even once during runtime. (Even on bad userspace mmap() operations with a zero’d out length, EINVAL is returned) Anyways, please refrain from using AI to contribute here, or in any project in general. |
This PR improves performance in:
Paging: Faster virtual mapping with cleaner loops and better use of const/inline.
Scheduler: More efficient task switching and reduced overhead.
Graphics: Optimized drawRect with pointer arithmetic.
Improves speed and readability across core systems.