Skip to content

STL_Extension: Use Boost Heap #3693

Closed
maxGimeno wants to merge 19 commits intoCGAL:masterfrom
maxGimeno:Use_boost_heap-GF
Closed

STL_Extension: Use Boost Heap #3693
maxGimeno wants to merge 19 commits intoCGAL:masterfrom
maxGimeno:Use_boost_heap-GF

Conversation

@maxGimeno
Copy link
Copy Markdown
Contributor

@maxGimeno maxGimeno commented Feb 19, 2019

Summary of Changes

Replace the use of Modifiable_priority_queue with Boost::heap::fibonacci_queue.
EDIT: The reason is that Modifiable_priority_queue is an undocumented header that we want to avoid now that Boost provides a reliable replacement for it.

Release Management

  • Affected package(s):AABB_tree, Polyline_simplifiaction_2, STL_Extension, Surface_mesh_simplification

@maxGimeno maxGimeno added the Not yet approved The feature or pull-request has not yet been approved. label Feb 19, 2019
@maxGimeno maxGimeno added this to the 4.15-beta milestone Feb 19, 2019
@maxGimeno maxGimeno self-assigned this Feb 19, 2019
@maxGimeno maxGimeno requested a review from sloriot February 19, 2019 09:02
@afabri
Copy link
Copy Markdown
Member

afabri commented Feb 19, 2019

Can you explain why you do this change? Deprecation of Modifiable_.., a fix of a bug, a convincing benchmark,....

@maxGimeno
Copy link
Copy Markdown
Contributor Author

@afabri see the Edit in the description

@afabri
Copy link
Copy Markdown
Member

afabri commented Feb 19, 2019

@afabri see the Edit in the description

Can you please make a performance test, for example for surface mesh simplication.

@maxGimeno
Copy link
Copy Markdown
Contributor Author

I used the test_edge_collapse_Polyhedron_3 with a 340 000 vertices (1919448 edges) chinese dragon, here are the results:
Before PR : 41.71s
After PR: 36.85s

@afabri
Copy link
Copy Markdown
Member

afabri commented Feb 19, 2019

I used the test_edge_collapse_Polyhedron_3 with a 340 000 vertices (1919448 edges) chinese dragon, here are the results:
Before PR : 41.71s
After PR: 36.85s

That's good news!!!

@sloriot
Copy link
Copy Markdown
Member

sloriot commented Feb 22, 2019

Quick question: Instead of modifying the code of various packages, would it be possible to update only the implementation of Modifiable_priority_queue using the boost documented heap?

@maxGimeno
Copy link
Copy Markdown
Contributor Author

I don't know. It wouldn't be trivial, that's all I can say without trying.

@sloriot
Copy link
Copy Markdown
Member

sloriot commented Feb 22, 2019

With an external view, that's a bit surprising.

@afabri
Copy link
Copy Markdown
Member

afabri commented Feb 22, 2019

I guess what Sebastien want's to say that it is probably easy to use the fibonacci_heap as an implementation detail which can be de/activated with a #define, right as it is done now with a boost::relaxed_heap

@maxGimeno
Copy link
Copy Markdown
Contributor Author

I looked back at the diff, it seems easier than I thought. Theproblem is we need to embark the map and maintain it, where it is not always needed, so there will be a loss of performance in Edge_collapse.

@sloriot
Copy link
Copy Markdown
Member

sloriot commented Feb 22, 2019

My guess is that the use in polyline simplification was not optimal as those type of heaps are bad for contains query. In mesh simplification, the handle are already stored by the algo. So maybe the implementation of polyline simplification should be updated.

@afabri
Copy link
Copy Markdown
Member

afabri commented Oct 15, 2019

What are the total times of the executables? How often are they executed?

@maxGimeno
Copy link
Copy Markdown
Contributor Author

maxGimeno commented Oct 15, 2019

You can check the code of the test to find that out.
They are executed 5 times each and the printed time is the average.

@maxGimeno
Copy link
Copy Markdown
Contributor Author

  • (there are alternative functions without the handles)

If they exist, they are not documented :/

@maxGimeno
Copy link
Copy Markdown
Contributor Author

The map management is too costly, even with abseil's flat_hash_map.

@MaelRL MaelRL changed the base branch from master to releases/CGAL-4.14-branch March 26, 2020 20:01
@MaelRL MaelRL changed the base branch from releases/CGAL-4.14-branch to master March 26, 2020 20:01
@MaelRL MaelRL modified the milestones: 5.1-beta, 5-2-beta Apr 7, 2020
@maxGimeno
Copy link
Copy Markdown
Contributor Author

maxGimeno commented Oct 16, 2020

The map management is too costly, even with abseil's flat_hash_map.

@sloriot I think we decided that this PR was not to be integrated, because the benchmarks were really bad. Should we close that PR ?

@maxGimeno maxGimeno modified the milestones: 5.2-beta, Trash / Attic Oct 26, 2020
@afabri
Copy link
Copy Markdown
Member

afabri commented Mar 4, 2021

@maxGimeno can you check if the new function std::map<>::extract() is a possible replacement.

@sloriot
Copy link
Copy Markdown
Member

sloriot commented Mar 4, 2021

@afabri meant using std::map that has a new function in c++17 that could be used to update the priority. (Maybe you can keep the wrapper to simplify the testing?)

@maxGimeno
Copy link
Copy Markdown
Contributor Author

so IIUC, the task is to design a heap based on a c++17 std::map<cost, type> to replace the mutable_queue_with_remove, use this custom heap internally to the Modifiable_priority_queue and finally retry the bench ?

@sloriot
Copy link
Copy Markdown
Member

sloriot commented Mar 30, 2021

Something like that, maybe hidden behind a #ifdef CGAL_USE_FOOBAR

@maxGimeno maxGimeno force-pushed the Use_boost_heap-GF branch 2 times, most recently from 879f8d9 to a6cc0a0 Compare April 1, 2021 08:10
@sloriot sloriot force-pushed the Use_boost_heap-GF branch from a6cc0a0 to 2174af9 Compare April 1, 2021 09:13
@maxGimeno
Copy link
Copy Markdown
Contributor Author

Here I tried an implementation based on a cxx17 set, using the function extract() for update(), and it is still slower than the master version.

@sloriot sloriot self-assigned this Aug 30, 2021
@maxGimeno maxGimeno marked this pull request as draft September 2, 2021 13:15
@sloriot
Copy link
Copy Markdown
Member

sloriot commented Nov 30, 2021

Replaced by #6155

@sloriot sloriot closed this Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants