BabyCakes13 / BabyCakes13/GlacierImagePredictor
Optimise distance pruning.
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Old distance formula implementation:
```python
x_distance = abs(reference_point[0] - image_point[0])
y_distance = abs(reference_point[1] - image_point[1])
if x_distance < AlignedImage.ALLOWED_SHIFTING_DISTANCE and
y_distance < AlignedImage.ALLOWED_SHIFTING_DISTANCE:
```
Current distance formula:
```python
x_distance = abs(reference_point[0] - image_point[0])
y_distance = abs(reference_point[1] - image_point[1])
distance = math.sqrt(math.pow(x_distance, 2) + (math.pow(y_distance, 2)))
if euclidean_distance < AlignedImage.ALLOWED_SHIFTING_DISTANCE:
```
The square root is known to be heavy on the computation and will slow (significantly?). A stopwatch test should be good enough to settle the thing.
https://latkin.org/blog/2014/11/09/a-simple-benchmark-of-various-math-operations/
https://scicomp.stackexchange.com/questions/2168/what-is-the-computational-cost-of-sqrtx-in-standard-libraries
https://stackoverflow.com/questions/22332750/why-is-square-root-such-a-slow-operation
Possible improvement - raise the square root to power.
```python
x_distance = abs(reference_point[0] - image_point[0])
y_distance = abs(reference_point[1] - image_point[1])
distance = math.pow(x_distance, 2) + (math.pow(y_distance, 2))
if euclidean_distance < math.pow(AlignedImage.ALLOWED_SHIFTING_DISTANCE, 2):
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the AlignedImage distance-pruning entry point and compare the current formula with the proposed alternative. Run a stopwatch benchmark and verify that the pruning boundary behaves the same; done means the faster approach is measured and its result is confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100