Skip to content

Minor Performance tweaks - #17

Merged
codelucas merged 1 commit into
codelucas:masterfrom
techaddict:master
Jan 22, 2014
Merged

Minor Performance tweaks#17
codelucas merged 1 commit into
codelucas:masterfrom
techaddict:master

Conversation

@techaddict

Copy link
Copy Markdown
Contributor

Changes

  • length_score - we can just pass the length of the string
  • title_score - number of comparisons reduced

@codelucas

Copy link
Copy Markdown
Owner

I don't understand the length_score change. Is there actually a performance boost from computing the length of the string outside of a method versus inside? I don't think so.

The title_score change is thoughtful. Ill merge if you can explain the purpose of length_score.

@techaddict

Copy link
Copy Markdown
Contributor Author

Not a major performance boost. why pass the whole string between the functions? I think passing a Integer is much better than passing a string.

@codelucas

Copy link
Copy Markdown
Owner

Oh wait what, maybe this was a hole in my computer science education. How is passing a string in this case any worse than passing an integer? Can you reference me something to read, sorry now i'm just curious.

@techaddict

Copy link
Copy Markdown
Contributor Author

My bad, i thought python makes copies of passed objects :) but still why do we need the whole string if the calculations are performed only on its length ?

@codelucas

Copy link
Copy Markdown
Owner

ok ok ok im merging haha

codelucas added a commit that referenced this pull request Jan 22, 2014
@codelucas
codelucas merged commit abfe0c0 into codelucas:master Jan 22, 2014
@techaddict

Copy link
Copy Markdown
Contributor Author

👍 :)

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