Jump to content

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;
        if(localiter > 10){
        vtxpt = hedge_dstpoint(0, currenthedge);
        lookuptwin = foundpts[vtxpt];
        if(lookuptwin == -1){
            setpointattrib(0, "twin", vtxpt, baseindex);
            //foundpts[vtxpt] = baseindex;
        append(newhedges, hedge_nextequiv(0, currenthedge));
        if (reversedir){
            currenthedge = hedge_prev(0, currenthedge);
            currenthedge = hedge_next(0, currenthedge);
    }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:


On iteration 8:



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.




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...