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

Performance issue with the redundancy operations #16

Open
yyzdtccjdtc opened this issue May 30, 2022 · 1 comment
Open

Performance issue with the redundancy operations #16

yyzdtccjdtc opened this issue May 30, 2022 · 1 comment

Comments

@yyzdtccjdtc
Copy link

widths[index] = max(widths[index], cell.width);

For this line of code, it will always update the value of widths[index], even if the value of it does not change. This introduces some redundant operations.

If we change the code to this, we can eliminate these redundant operations.

if widths[index] < cell.width{
     widths[index] = cell.width;
}

According to my tests, the average execution time decreased from 6.5s to 4.8s, which is a 1.37x speedup.

Hope this information helps!

@pengfei-su
Copy link

@ogham
Is this repo still maintained?

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