Gaming32 / ArrayV

New home of https://github.com/MusicTheorist/ArrayVisualizer
MIT License
305 stars 47 forks source link

Parallel Block Merge mental breakdown #43

Closed Gaming32 closed 3 years ago

Gaming32 commented 3 years ago

Just run Parallel Block Merge Sort yourself and view the carnage.

For reference: https://youtu.be/0ae2q700NNc?t=8249

EmeraldBlock commented 3 years ago

seems to be caused by the changes to Highlights.java Confirmed that this bug is caused by something between 2f13f2d and e99782d (see #39).

Interestingly the behavior of the sort changes too - it fails despite its code not being altered

EmeraldBlock commented 3 years ago

Cause identified: Highlights.clearAllMarks() was not synchronous. I have no clue how that fixes this.

Gaming32 commented 3 years ago

Ah yes, threading without a GIL to keep you safe. always fun

EmeraldBlock commented 3 years ago

clearAllMarks() is used by binary insertion sort which is used by parallel block merge, so I guess that's how it's relevant

still no clue how this alters the sort's behavior; the Highlights functions only modify Highlights properties Oh, the issue was just that the exceptions thrown by the Highlights functions killed the sorting threads