Jump to content
EdArt

Vex explosive slowdown (~%8000) on simple program and mesh

Recommended Posts

Hi all,

I'm running a simple topological vex function over a mesh, designed for topological symmetry. The function below is run in either a compiled for-loop or a SOP solver, I got the same performance from each:


function int[] crawlmesh5(int geo;
     int basehedge;
     int reversedir;
     int baseindex;
     int foundpts[];
     int foundprims[];
    ){
    int newhedges[];

    // early out if prim has been processed
    int primfound = foundprims[hedge_prim(0, basehedge)];
    if (primfound){
        return newhedges;
    }
    //return newvtxes;
    int localiter = 0;
    int currenthedge = basehedge;
    int vtxpt, lookuptwin;
    do{
        if(localiter > 10){
            printf("failsafe-break_");
            break;
        }
        vtxpt = hedge_dstpoint(0, currenthedge);
        lookuptwin = foundpts[vtxpt];
        if(lookuptwin == -1){
            setpointattrib(0, "twin", vtxpt, baseindex);
            //foundpts[vtxpt] = baseindex;
            baseindex++;
        }
        append(newhedges, hedge_nextequiv(0, currenthedge));
        if (reversedir){
            currenthedge = hedge_prev(0, currenthedge);
        }
        else{
            currenthedge = hedge_next(0, currenthedge);
        }
        localiter++;
    }while (currenthedge != basehedge);

    setprimattrib(0, "found", hedge_prim(0, basehedge), 1);

    return newhedges;
}

Since wrangles would produce race conditions in the numbering of found points, I'm running this in a detail wrangle, in a manual loop over an array of half edges. foundprims and foundpts are passed by reference and used in place of setting component attributes, and both are saved to and loaded from detail attributes between iterations.

When running this function on a grid of 500 points, I get the following performance:

On iteration 7:

image1.thumb.png.ee97e4a4d711838f1c8ebba2dee2c244.png

On iteration 8:

image2.thumb.png.b683ecddd29eb3454a87b97cc5d7966b.png

 

A slowdown of roughly %8000 .

The size of the arrays are not changing across iterations, as far as I can tell nothing is changing other than their content.

 

If anyone has any idea what I'm doing wrong, I will be extremely grateful.

Thanks

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×