Sonjli 6 Posted January 25, 2021 Hello, I have a task with three nested loops using an XML library to read some parts of a big XML. This loop is too tight and processor works between 20% and 30% only for this process. The "sleep" is not a solution because the XML must be read very quickly. Is there any other solution to avoid the use of so much processor? Thanks, Eddy Share this post Link to post
David Heffernan 2353 Posted January 25, 2021 I'm not sure what you want to do. Do you want to read the XML quickly? Or do you want to read the XML without using CPU resources? Because it seems like you want to do both but of course you can do one or the other but not both. Share this post Link to post
Fr0sT.Brutal 900 Posted January 26, 2021 Show us your code, probably it could be optimized though I wouldn't count on great improvement. Reading and manipulating big XML is always quite slow Share this post Link to post
Sonjli 6 Posted January 26, 2021 7 hours ago, David Heffernan said: I'm not sure what you want to do. Do you want to read the XML quickly? Or do you want to read the XML without using CPU resources? Because it seems like you want to do both but of course you can do one or the other but not both. I need to read the XML quickly. But the server administrator warn me often about high cpu. I understand your axiom. I use Neslib.Xml and it seems well done both in performance and resource utilization. So you recommend me to say to sa to "put his heart in peace"... 24 minutes ago, Fr0sT.Brutal said: Show us your code, probably it could be optimized though I wouldn't count on great improvement. Reading and manipulating big XML is always quite slow I can publish the problematic loops but, as you write, the "problem" is implicitly the XML library. Thanks guys. Share this post Link to post
Lars Fosdal 1793 Posted January 26, 2021 @Sonjli - Did you read this article? https://blog.grijjy.com/2020/10/07/an-xml-dom-with-just-8-bytes-per-node/ Not sure how that lib would fare with regards to CPU usage - but it should be fast enough. Edit: Doh... I didn't realize Neslib was the lib in the article 😛 Need more coffee. 1 Share this post Link to post
Sonjli 6 Posted January 26, 2021 21 minutes ago, Lars Fosdal said: @Sonjli - Did you read this article? https://blog.grijjy.com/2020/10/07/an-xml-dom-with-just-8-bytes-per-node/ Not sure how that lib would fare with regards to CPU usage - but it should be fast enough. Edit: Doh... I didn't realize Neslib was the lib in the article 😛 Need more coffee. I need strongest drugs... but also for me a coffee is enough for now 😅 Share this post Link to post
tjp1955 1 Posted December 22, 2021 Very late comment: Your SA needs to modify his/her criteria, and instead look at percentage of CPU used by your App and other running Apps. Also, if your App is the only one running - who cares how much CPU it is using, let it use 100%. The SA also needs to look at the business criteria for the Apps running. If your App is a business critical App and it needs to process the XML faster than other running Apps need to get their work done, then it deserves to get a greater amount of CPU time, or perhaps it needs its own server. Share this post Link to post
ioan 45 Posted December 22, 2021 Do you have high CPU usage even if there aren't any xml files to read? If that's the situation, I agree, there probably is a problem with your code. Do you have this loop in a separate thread? Is it in the main thread? Share this post Link to post