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

Unnecessary reslicing on ranged slice for BCE #2

Closed
maverickwoo opened this issue Apr 8, 2018 · 1 comment
Closed

Unnecessary reslicing on ranged slice for BCE #2

maverickwoo opened this issue Apr 8, 2018 · 1 comment

Comments

@maverickwoo
Copy link

vecf64/arith.go

Lines 8 to 10 in 6314d1b

a = a[:len(a)]
b = b[:len(a)]
for i, v := range a {

Since the loop in L10 ranges over a, there is no need to reslice a in L8 to force a bound check on a. Although no instruction is generated for L8 (at least not in optimized mode, where I have checked), perhaps it may be a good idea to not have this and similar lines lingering in the source? If so, you may also want to update README.md to say it is b = b[:len(a)] that is critical.

(Just to be clear, yes, the reslice of b in L9 is indeed critical for BCE. I am only talking about L8 here.)

@chewxy
Copy link
Member

chewxy commented Apr 8, 2018

Hm, so Go's BCE has gotten much smarter. Will update. Thanks

@chewxy chewxy closed this as completed in 8f2bcc9 May 31, 2018
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