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

Python optimization #524

Open
tuxgitbot bot opened this issue Sep 7, 2024 · 5 comments
Open

Python optimization #524

tuxgitbot bot opened this issue Sep 7, 2024 · 5 comments
Labels
category: meta Relating to architecture, systems and critical functions priority: critical type: discussion type: enhancement

Comments

@tuxgitbot
Copy link

tuxgitbot bot commented Sep 7, 2024

Figure out how to optimize where possible at a lower level and explore areas for improvement

@kzndotsh kzndotsh added category: meta Relating to architecture, systems and critical functions type: enhancement type: discussion priority: critical labels Sep 7, 2024
@arutonee1
Copy link

Not sure if this is mentioned in one of those links, but you can use python3 -m cProfile main.py to profile a given file, or use the @profile decorator from profilehooks to profile a given function

make sure you don't spend to much time optimizing things that are negligible to the rest of the program

@arutonee1
Copy link

arutonee1 commented Sep 7, 2024

Also, here's a really simple (untested) decorator that logs the runtime of a function after it's run. With a few project-specific modifications it may be useful

import time
def time_fn[F](fn: F) -> F:
    def out(*args, **kwargs):
        start = time.perf_counter()
        fn(*args, **kwargs)
        end = time.perf_counter()
        logger.log(f'{fn.__name__} took {end - start} seconds')
    return out

@Nandini1071
Copy link

Hi @kzndotsh is this issue still open, if yes then what is the requirement would like to contribute on this.

@kzndotsh
Copy link
Contributor

kzndotsh commented Sep 21, 2024

Hi @kzndotsh is this issue still open, if yes then what is the requirement would like to contribute on this.

Yes, it's still open. What do you mean by "requirement"? The issue is pretty wide open more as a discussion at the moment I suppose so I'm open to any direction/small changes or other issues can be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: meta Relating to architecture, systems and critical functions priority: critical type: discussion type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants