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

Make the code faster by compiling regex on global context and reusing named collection. #20

Merged
merged 3 commits into from
Jan 21, 2019

Conversation

jaysonsantos
Copy link
Contributor

Running the following code as benchmark

import timeit
import giturlparse

URLS = [
    '[email protected]:jaysonsantos/abc.git',
    'https://github.com/jaysonsantos/abc.git'
]

print(timeit.timeit(
    """
parsed = [giturlparse.parse(url) for url in URLS]
""",
    number=100_000,
    globals={
        'URLS': URLS,
        'giturlparse': giturlparse
    }))

on master it returned 20.684334864999997 and on my branch 1.4601109110000001

@retr0h retr0h merged commit 249795e into coala:master Jan 21, 2019
@retr0h
Copy link
Collaborator

retr0h commented Jan 21, 2019

Thanks @jaysonsantos you rock! \m/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants