Magialisk wrote:einstein thanks for the clarification. I'm still trying to digest your changes since the logical flow of the loops is different I need to make sure I understand the new flow. It took me a while to redesign my algorithms to combine the Sub and Shift, and combine Mix and XOR. Now I have to understand how your rearrangement of those functions is working.
As you can see I didn't implement everything that Antonio did in his version of the code either because that's his code and this is my code, and I want to understand what I'm doing and write it myself. You guys have both provided great suggestions and eventually once I chew on them a bit I've been able to incorporate the stylistic improvements. If I just copied your code or his directly though, it would run faster but it wouldn't do me much good in an educational sense
P.S. - I was going to propose a compromise regarding the ping delay. I think the delay subroutine should use the CPU count and if its equal to 1-3 add some delay there. So something like:
1-3 CPU: controller + 'n' PIDs, 500ms sleep
4+ CPU: controller + 'n-1' PIDs, no sleep
Have you tested whether 500ms is the best value, as I would suspect longer delays (to a point) could give better results. Evan an extra 2000ms wait at the end of an operation for the controller to wake back up would be nothing if the longer sleep throughout let the operation finish 10 seconds faster overall... Let me know what you think or if you've done any testing. In fact, maybe that's what I need to do on my higher core counts, is sleep for longer... I think I'll poke at this and see what happens.
Magialisk wrote:einstein thanks for the clarification. I'm still trying to digest your changes since the logical flow of the loops is different I need to make sure I understand the new flow. It took me a while to redesign my algorithms to combine the Sub and Shift, and combine Mix and XOR. Now I have to understand how your rearrangement of those functions is working.
As you can see I didn't implement everything that Antonio did in his version of the code either because that's his code and this is my code, and I want to understand what I'm doing and write it myself. You guys have both provided great suggestions and eventually once I chew on them a bit I've been able to incorporate the stylistic improvements. If I just copied your code or his directly though, it would run faster but it wouldn't do me much good in an educational sense
Take all the time you need to make the changes.
The code written by others is always difficult to read. It requires a huge effort, but this effort opens the mind. Sometimes you do not need to know what makes that piece of code. Sometimes you need only know the technique used. Understood the technique you can fix anything with that technique. It 'also obvious that then we have to use our head to write something because the goal is the mastery of what we're doing.
So I agree with you not to copy but to parrot to understand and make our own and then put it into practice.
P.S. - I was going to propose a compromise regarding the ping delay. I think the delay subroutine should use the CPU count and if its equal to 1-3 add some delay there. So something like:
1-3 CPU: controller + 'n' PIDs, 500ms sleep
4+ CPU: controller + 'n-1' PIDs, no sleep
Have you tested whether 500ms is the best value, as I would suspect longer delays (to a point) could give better results. Evan an extra 2000ms wait at the end of an operation for the controller to wake back up would be nothing if the longer sleep throughout let the operation finish 10 seconds faster overall... Let me know what you think or if you've done any testing. In fact, maybe that's what I need to do on my higher core counts, is sleep for longer... I think I'll poke at this and see what happens.
when pool the finish of all processes we can choice a low frequency of polling for consume less CPU.
- High frequency consume CPU but give readily when finish all process. The time passing from the end of all process and when we take note is low. what should be down?
- Low frequency consume low CPU but whe take note of the end of all process after a long time. This delay the execution time. How much is the consumption of the CPU?
How do you see the parameters to find are two. You have to reach a compromise.
Low CPU + Low Rensponsivity in this case is the goal.
But ping has a problem for timing < 500 ms (I've shown this
here)
the command used is: " ping 192.0.2.0 -n 1 -w %delay% > nul "
At 500 ms the usage of cpu is very low (measured on my machine 3.2%). On multicore system this value must be divided for number of core. ie on dual processor is <1,6% about. On quad core <0.8% (<1%) etc (this value of multiprocessor/core system are calculated)
at 1000ms use 1.7% ( this value is measured)
at 2000ms use 1.0% about (this value is measured) (<0,25% su quad core, this value is calculated)
I have used typeperf with 20sec. samples on idle system to misure.
Edit: In reality on a multicore system the formula is different from the divide by the number of cores. The consumption is less
einstein1969