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

checker: minor cleanup of fn_decl #19627

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Oct 22, 2023

Merges some redunant checks, checks less taxing conditions first.

Not as relevant for comptime things. Still, tcc compiled it's 1500%+ for e.g.:

b := false
a := 'abcde'
for _ in 0 .. 1_000_000 {
	if a == 'abcde' && b {
		// println('true')
	}
}

vs

- if a == 'abcde' && b {
+ if b && a == 'abcde' {

🤖 Generated by Copilot at f2d5fa6

Refactor and simplify function checking code in vlib/v/checker/fn.v. Move some checks inside a more specific condition and remove unnecessary ones.

🤖 Generated by Copilot at f2d5fa6

  • Refactor function checking logic to reduce nesting and simplify conditions (link)

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@spytheman spytheman merged commit 65d7126 into vlang:master Oct 23, 2023
36 of 52 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.

2 participants