• About Java and Delphi and Freepascal.. (2/2)

    From Wisdom90@21:1/5 to Bonita Montero on comp.programming. on Mon Jan 27 12:19:48 2020
    [continued from previous message]

    needs to be at least 1000 iterations. When in doubt, do the following experiment:

    1- Set the grainsize parameter higher than necessary. The grainsize is specified in units of loop iterations.

    If you have no idea of how many clock cycles an iteration might take,
    start with grainsize=100,000.

    The rationale is that each iteration normally requires at least one
    clock per iteration. In most cases, step 3 will guide you to a much
    smaller value.

    2- Run your algorithm.

    3- Iteratively halve the grainsize parameter and see how much the
    algorithm slows down or speeds up as the value decreases.

    A drawback of setting a grainsize too high is that it can reduce
    parallelism. For example, if the grainsize is 1000 and the loop has 2000 iterations, the ParallelFor() method distributes the loop across only
    two processors, even if more are available.

    And you can pass a parameter in Ptr as pointer to ParallelFor(), and you
    can set pmode parameter of to pmBlocking so that ParallelFor() is
    blocking or to pmNonBlocking so that ParallelFor() is non-blocking, and
    the Priority parameter is the priority of ParallelFor(). Look inside the test.pas example to see how to use it.

    Thank you,
    Amine Moulay Ramdane.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)