elihschiff opened a new pull request, #536: URL: https://github.com/apache/yunikorn-core/pull/536
### What is this PR for? The node.preAllocateCheck() function gets run a lot during the scheduling cycle. The function is effectively a boolean function, either the node can be allocated on or it cannot. Instead of returning a bool it returns nilĀ for true and a full error message for false. The thing is, that error message is never read anywhere. From what I can tell, the only thing the code does is check if there is an error message but not the contents. I ran a profiler on the code and noticed that about 25% of the scheduling cycle was spend on generating these error messages that are not used. By switching to a bool for the return value it should improve the performance of this one function and therefore the entire scheduling cycle overall. ### What type of PR is it? * [ ] - Bug Fix * [x] - Improvement * [ ] - Feature * [ ] - Documentation * [ ] - Hot Fix * [ ] - Refactoring ### Todos N/A ### What is the Jira issue? https://issues.apache.org/jira/browse/YUNIKORN-1720 ### How should this be tested? I have it running on my end and it seems to work. The unit tests also pass after I updated them to look at the new boolean value over the old error message. ### Screenshots (if appropriate) Before this change (note the large `(*Resource).String (resources.go:L#110)` section under the highlighted function): <img width="1134" alt="image" src="https://user-images.githubusercontent.com/18558130/235989846-ae798dc3-5e3f-4d52-84e7-64d171b5e940.png"> After this change: <img width="1128" alt="image" src="https://user-images.githubusercontent.com/18558130/235989957-a8159b5e-ed50-4008-8112-8644544da5b8.png"> ### Questions: * [ ] - The licenses files need update. * [ ] - There is breaking changes for older versions. * [ ] - It needs documentation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
