bpglaser / red-mountain-resize

An image resize tool utilizing seam carving.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate replacing grid internal container

bpglaser opened this issue · comments

A simpler internal grid representation would make transitioning to multi-thread much simpler.

Attempts were made to replace grid internals with alternatives. None proved fruitful. Thus, with the current carver algorithm, a 2d vec is the most viable.

Stats for subtracting 5 from castle width:

  • Hashmap 16.64s
  • Vec 20.45s
  • Vec<Vec<T>> 1.90s

Given the large number of reallocation due to shifts in the grid, it might be worthwhile to use a linked list container.

Changing the internal structure led to massive improvements in performance:

command grid-rotation-rework master % faster
-w -100 3.689447611 4.769283138 22.64%
-h -100 5.455471693 13.48595331 59.55%
-w -100 -h -100 8.971742094 17.9943384 50.14%
-w +100 4.620084357 5.897690078 21.66%
-h +100 6.80669775 21.28925174 68.03%
-w +100 -h +100 11.74770414 31.4032533 62.59%