Replies: 3 comments 3 replies
-
I'm certainly interested in stabilising clipping results between the various compilers, but my concern is that stable sorts are more time costly. (Note: In Edit: The following change doesn't seem to impact on performance: Does this reduce the differences in results between compilers? |
Beta Was this translation helpful? Give feedback.
-
@AngusJohnson |
Beta Was this translation helpful? Give feedback.
-
Thanks for changes. It is stable now. |
Beta Was this translation helpful? Give feedback.
-
Every platform has its own default implementation of C++ STL, and each STL has its own implementation of std::sort which give slightly different results depending on how they are implemented.
This means you can get slightly different results from Clipper, depending on which platform it is compiled and run.
I tested my program for such differences and found one of them in clipper:
Clipper2/CPP/Clipper2Lib/src/clipper.engine.cpp
Line 777 in 959f96e
To simulate potential differences between platforms I added the following snippe before each std::sort in all sources:
And at least for line 777 I start to get slightly different results with the same inputs to clipper.
Of course I also found similar differences between Clipper2 built on libc++ (AppleClang) and MSVC.
I wonder if that sorting can be stabilized by improvements to LocMinSorter() ?
Of course another option is to use std::stable_sort, but that requires 2*N memory AFAIK.
If you are interested I can try to dump inputs that produce different results depending on sorting.
Beta Was this translation helpful? Give feedback.
All reactions