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

Dev/small speedup to test if we changed right thing #3977

Merged
merged 5 commits into from
Nov 28, 2024

Conversation

ValarDragon
Copy link
Member

Start speeding up IntPretty/PricePretty constructors which are shown to be quite expensive in prod.

This is trying to first initially validate if this is editing the right spot (as profiles look fairly different on vercel preview vs prod), before going for larger wins.

Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
osmosis-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2024 3:34pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
osmosis-frontend-datadog ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 3:34pm
osmosis-frontend-dev ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 3:34pm
osmosis-frontend-edgenet ⬜️ Ignored (Inspect) Nov 28, 2024 3:34pm
osmosis-testnet ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 3:34pm

export class Coin {
public static parse(str: string): Coin {
const re = new RegExp("([0-9]+)[ ]*([a-zA-Z]+)$");
const execed = re.exec(str);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings with many repetitions of '0'.
}

export function isValidDecimalString(str: string): boolean {
return regexDecString.test(str);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetitions of '00'.
This
regular expression
that depends on
library input
may run slow on strings starting with '0' and with many repetit
@ValarDragon
Copy link
Member Author

Confirmed this is speeding up the right spot. That first commit dropped the IntPretty constructor time down by 8%. Will proceed going for more significant reductions

@ValarDragon
Copy link
Member Author

Its hard to apples to apples compare across feature branches (And that the numbers are way different than what I get on stage) but at least on a profile before and after the last commit, i got what appears to be a 3x speedup on the IntPretty load times. (Many IntPretty clones were called before, but now we save expensive dec logic in each)

If its possible would like to get to prod and measure whats the impact. I'll continue with some more slight improvements around, but I think this is likely an 80-20 for impact.

Of the 4.4s refresh time I saw on main, this should eliminate at least 2s. I'd like to rebenchmark to see if more was removed

@ValarDragon
Copy link
Member Author

Last commit fixes remaining excess string calls / allocs in the IntPretty initializer. Not seeing more math loading time on feature branch refreshes. Will check more on main app once we merge this in though

But I currently think remaining speed improvements will now lie elsewhere

@JoseRFelix JoseRFelix merged commit 2f7e8f7 into stage Nov 28, 2024
34 checks passed
@JoseRFelix JoseRFelix deleted the dev/small_speedup_to_test_if_we_changed_right_thing branch November 28, 2024 15:37
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.

2 participants