Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MakePath64 very slow #3

Open
FishOrBear opened this issue May 31, 2024 · 2 comments
Open

MakePath64 very slow #3

FishOrBear opened this issue May 31, 2024 · 2 comments

Comments

@FishOrBear
Copy link

        const { MakePath64, Paths64, FillRule, Union64 } = MainModule

        for (let i = 0; i < 10000; i++)
        {

            let a = [-5070000, -23550000, 7710000, -23550000, 7710000, 22590000, -5070000, 22590000];
            let b = [0, 0, 7140200, 0, 7140200, 860200, 0, 860200];

            const subject = new Paths64();
            const clip = new Paths64();

            const combinedNfp1 = Union64(subject, clip, FillRule.NonZero);
            subject.push_back(MakePath64(a));

            const subject1 = new Paths64();
            subject1.push_back(MakePath64(b));
            let finalNfp1 = clipperCpp.lib2.Difference64(subject1, combinedNfp1, FillRule.NonZero);

            let fnfp = [];
            for (let i = 0; i < finalNfp1.size(); i++)
            {
                let path = finalNfp1.get(i);
                path.size();
                let arr = [];
                for (let j = 0; j < path.size(); j++)
                {
                    let p = path.get(j);
                    arr.push({ x: p.x, y: p.y });
                }

                fnfp.push(arr);
            }

            // console.log(fnfp);
        }

@FishOrBear
Copy link
Author

Data transfer from js->cpp should be avoided as much as possible, and should be transferred once.

@ErikSom
Copy link
Owner

ErikSom commented Dec 7, 2024

Hi @FishOrBear , could you see if the changes in:
#5
Improve the performance for you?

If this works I can replace the original MakePath with the new improved one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants