Merge lp:~robru/friends/linkify into lp:~super-friends/friends/raring
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 178 |
Merged at revision: | 177 |
Proposed branch: | lp:~robru/friends/linkify |
Merge into: | lp:~super-friends/friends/raring |
Diff against target: |
176 lines (+116/-3) 3 files modified
friends/tests/test_protocols.py (+76/-1) friends/tests/test_twitter.py (+3/-2) friends/utils/base.py (+37/-0) |
To merge this branch: | bzr merge lp:~robru/friends/linkify |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
Review via email: mp+153965@code.launchpad.net |
Description of the change
Alright Ken, the regex was a little bit more complicated than I had anticipated, but I've taken steps to ensure that it is readable, and also I've included some quite comprehensive tests against it, so long term maintenance of it shouldn't be too difficult.
It's speedy, too! You were complaining that the frontend was not very performant while trying to linkify URLs, so I did a bit of profiling with this. Seems it handles an empty string in 6.0 usec, a URL-only string in 10.8 usec, an average sentence in 13.8 usec, and max-tweet-length in 16.6 usec.
Also, on top of that, we also get the performance benefit of only having to do it once, and then caching the result (as opposed to the frontend which would have to re-do it every time it displayed any message).
Works great!