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

1D ArrayLike data as input #26

Open
naoak opened this issue Nov 18, 2021 · 1 comment
Open

1D ArrayLike data as input #26

naoak opened this issue Nov 18, 2021 · 1 comment

Comments

@naoak
Copy link

naoak commented Nov 18, 2021

Hi,
MarchingSquaresJS requires 2-dimensional input data, but i have very huge 1-dimensional ArrayLike data (e.g. Float32Array). Is there any better way than converting it to 2D data? One thing I'm thinking about is to support multi-dimensional arrays like ndarray whose data source is 1D ArrayLike but can be accessed as like 2D array by get/set methods.
Any thoughts?
Thanks.

@naoak
Copy link
Author

naoak commented Nov 21, 2021

I've managed to achieve this. Here is sample codes.
https://codesandbox.io/s/ms-matrix-proxy-wmbk6?file=/src/main.js:219-273

We were able to reduce the memory usage compared to generating a 2D array. However, the performance of index access was 20 to 400 times worse due to the use of proxies.

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

1 participant