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

base/model/set.go代码优化 #2

Closed
laijinhang opened this issue May 12, 2020 · 1 comment
Closed

base/model/set.go代码优化 #2

laijinhang opened this issue May 12, 2020 · 1 comment
Labels
good first issue Good for newcomers

Comments

@laijinhang
Copy link

base/model/set.go

// Len returns the number of items in a set.
func (s *Set) Len() int {
	return len(s.List())
}

改成下面效率会更高

// Len returns the number of items in a set.
func (s *Set) Len() int {
	s.RLock()
	defer s.RUnlock()
	return len(s.m)
}
@dk-lockdown
Copy link

you can fix it

@dk-lockdown dk-lockdown added the good first issue Good for newcomers label May 12, 2020
luky116 pushed a commit that referenced this issue Jul 9, 2022
wang1309 pushed a commit to wang1309/seata-go that referenced this issue Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants