Skip to content

Reduce number of loops in tracker - #206

Open
ZhiyuanChen wants to merge 1 commit into
nwojke:masterfrom
ZhiyuanChen:patch-1
Open

Reduce number of loops in tracker#206
ZhiyuanChen wants to merge 1 commit into
nwojke:masterfrom
ZhiyuanChen:patch-1

Conversation

@ZhiyuanChen

Copy link
Copy Markdown

Slightly increase spped by reducing two for loop to one

Slightly increase spped by reducing two for loop to one
@alexnguyen2201

alexnguyen2201 commented May 1, 2020

Copy link
Copy Markdown

@zyc-ai a comprehension list is faster than a loop

@ZhiyuanChen

Copy link
Copy Markdown
Author

a comprehension list is faster than a loop

It seems not in the case of Python https://stackoverflow.com/a/43677631/8791650.

@kanasite

kanasite commented Nov 3, 2020

Copy link
Copy Markdown

a comprehension list is faster than a loop

It seems not in the case of Python https://stackoverflow.com/a/43677631/8791650.

I beg to diff, consider doing this instead

def square_sum4(numbers):
return(sum([i**2 for i in numbers]))

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.

3 participants