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

Optimize constant generation for arrays #2414

Open
chriseth opened this issue Jan 30, 2025 · 0 comments
Open

Optimize constant generation for arrays #2414

chriseth opened this issue Jan 30, 2025 · 0 comments

Comments

@chriseth
Copy link
Member

The clock in poseidon_gl_memory is defined as follows:

    let CLK: col[STATE_SIZE + OUTPUT_SIZE] = array::new(STATE_SIZE + OUTPUT_SIZE, |i| |row| if row % ROWS_PER_HASH == i { 1 } else { 0 });

The way we currently evaluate it is that we do it for every column in the CLK array in isolation. The evaluator (and also the JIT), though, computes the full array for every element of CLK and then returns the element.

This means we can speed up constant generation by a considerable amount if we treat arrays of fixed columns as a whole instead of as single elements of the array.

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