Skip to content

Performance impact #38

@corbett5

Description

@corbett5

I just came across this repository after looking for a solution to this exact problem, very excited! However when I was trying it out every line now goes through get_ipython().run_cell_magic('space', ...). This adds a few layers to every exception backtrace. Not a huge deal. However, this also comes with a pretty severe performance hit. See the following example

%%time
# %%space <first>

result = 0
for i in range(10000000):
    string = f'{10 * i / (3 * i + 7)}{87 * i * i / 258}'
    result += ord(string[i % len(string)])

print(result)

Without the %%space <first> the results are

CPU times: user 19.9 s, sys: 296 ms, total: 20.2 s
Wall time: 22.5 s

With %%space <first> the results are

CPU times: user 51.9 s, sys: 546 ms, total: 52.4 s
Wall time: 55.4 s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions