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

Major refactoring to integrate with a web API #238

Open
abelsiqueira opened this issue Apr 2, 2023 · 2 comments
Open

Major refactoring to integrate with a web API #238

abelsiqueira opened this issue Apr 2, 2023 · 2 comments
Assignees
Labels

Comments

@abelsiqueira
Copy link
Owner

The current implementation is too complicated, with too many parts tightly coupled. Here I will give an overview - for others and for myself - and a proposed solution.

A summary:

  • Each backend implements a Profiler.
  • Profiler extends Pdata.
  • Pdata calls parse.py functions to parse the code.
  • The parsing reads the specific format that we created, which is a table, but that is converged to a dictionary.
  • The Pdata is responsible for creating the cumulative function values.
  • Each backend implements the plot function.
  • The parser_options and profiler_options are obtained from the CLI arguments.
  • A single call is done: BACKEND.Profiler(parser_options, profiler_options).

Issues with this approach:

  • Since the tool was built with the CLI in mind, everything is mixed from the start.
  • There is no separation of parsing tasks and performance profiling tasks, evidenced by the passing of both arguments to the same class.
  • There is also no separation of backend and profiling, since the backend class is the profiler class.
  • Accessing perprof as a library is not possible without creating a file (or file-like structure).

Proposal of refactoring:

  • Create separate classes for separate functionalities.
    • SolverData reads the data of a single solver. It does the parsing and stores the raw values.
    • ProfileData computes the cumulative function values from an input of SolverData.
    • ProfileBackend plots the data.
  • Consider using numpy arrays and pandas.DataFrames to store these values.
  • Make sure that it works with the API.

Some things to keep in mind:

  • Keep the CLI working. Since the system is so tightly coupled, it should be possible to change anything inside Pdata without worrying about users losing access to the API (nobody should be using it anyway).
  • If only the most basic performance profile can be integrated, it should already be possible to have a better system.
  • Since the API changes will be small, we can release it as 1.2.0.
  • This should lead to Proposal: Perprof-py revamp #209 eventually.
@abelsiqueira
Copy link
Owner Author

@rgaiacs, @lrsantos11, quick update:
I have created https://github.com/abelsiqueira/perprof-web as a side project to learn more about Flask, backend vs frontend, serving a site, etc.
It's live on https://perprof.abelsiqueira.com, though I am not sure if I will leave it on. It is supposed to be working.

@lrsantos11
Copy link
Contributor

lrsantos11 commented May 24, 2023 via email

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

No branches or pull requests

2 participants