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

Adds index to accessor functions #207

Merged
merged 2 commits into from
Jun 5, 2024
Merged

Adds index to accessor functions #207

merged 2 commits into from
Jun 5, 2024

Conversation

mhkeller
Copy link
Owner

Normally you're passing an array of objects but I've been thinking about alternate setups where maybe you want to keep your data as separate typed arrays for x and y. You'd have something like

const xVector = new Uint32Array(data.map(d => d[xKey]));
const yVector = new Uint8Array(data.map(d => d[yKey]));

and then...

...
x={(d, i) => xVector[i]}
y={(d, i) => yVector[i]}
data={someFakeDataHere}

This is kind of a weird setup but I could see it possibly being useful for high-performance cases. Either way, seems potentially helpful to have the index in the accessory anway...

@mhkeller mhkeller merged commit 18755c7 into main Jun 5, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

1 participant