stefmolin / data-morph

Morph an input dataset of 2D points into select shapes, while preserving the summary statistics to a given number of decimal points through simulated annealing. It is intended to be used as a teaching tool to illustrate the importance of data visualization.
https://stefaniemolin.com/data-morph/
MIT License
60 stars 16 forks source link

Performance improvements for line shapes #197

Closed JCGoran closed 1 week ago

JCGoran commented 1 month ago

Is your feature request related to a problem? Please describe.

The performance of the line shape could be improved, as the performance is a bit slow compared to the circular shapes. For some performance numbers (tested with cProfile):

python -m cProfile -m data_morph --start-shape panda --target-shape star
320361688 function calls (316213771 primitive calls) in 116.715 seconds

Compare with:

python -m cProfile -m data_morph --start-shape panda --target-shape bullseye
83940221 function calls (83300500 primitive calls) in 41.067 seconds

Seems to be a factor of 4 more function calls, resulting in roughly 3x slower performance.

Describe the solution you'd like

Faster evaluation of line-line shapes.

Describe alternatives you've considered

None.

Additional context

None.

github-actions[bot] commented 1 month ago

It looks like this is your first issue here – welcome! Please familiarize yourself with the contributing guidelines, if you haven't already.