Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Re: Slow Polyhedron Clear Time and Problems with Kernels
- Date: Wed, 02 Feb 2011 14:34:41 +0100
I ran a small benchmark (code attached) on a model with
2,003,932 points and 4,007,872 faces (read from an OFF file).
Results are below.
Without having a complete and minimal example showing the problem,
I would say that you either:
*attached heavy data to vertices,halfedges or facets
*compiled in debug mode (with no optimization)
S.
Output:
Using Exact_predicates_inexact_constructions_kernel
default, list-based
Build 8.78812s.
Erase 0.379484s.
vector-based
Build 7.86276s.
Erase 0
Using Exact_predicates_exact_constructions_kernel
default, list-based
Build 9.88134s.
Erase 0.548244s.
vector-based
Build 8.5892s.
Erase 0.330766s.
Using Cartesian<double>
default, list-based
Build 9.16782s.
Erase 0.471216s.
vector-based
Build 7.89833s.
Erase 0.1019s.
Using Simple_cartesian<double>
default, list-based
Build 8.5126s.
Erase 0.372259s.
vector-based
Build 7.67358s.
Erase 0s.
titan99 wrote:
Sebastien Loriot (GeometryFactory) wrote:
Can you post the code used to measure these times?
S.
Yes, here's the code
void TerrainGrid::BuildPolyhedron()
{
BuildTerrainPolyhedron<HalfedgeDS> builder;
builder.vertices = &vertices;
builder.triangleIndexs = &triangleIndexs;
builder.progBuildPolyh = &progBuildPolyh;
polyhedron.delegate(builder);
progDestrPolyh.Initiate(1); //Measuring begins (the Object
progDestrPolyh
uses QueryPerformanceCounter from Windows-API)
polyhedron.clear();
progDestrPolyh.StepProgress(); //Measuring stops}
template <class HDS> void BuildTerrainPolyhedron<HDS>::operator()(HDS& hds)
{
size_t facetsSize = triangleIndexs->size() / 3;
progBuildPolyh->Initiate(vertices->size() + facetsSize + 1);
//Measuring
begins (the Object progBuildPolyh uses QueryPerformanceCounter from
Windows-API)
CGAL::Polyhedron_incremental_builder_3<HDS> builder(hds, false);
builder.begin_surface(vertices->size(), facetsSize, facetsSize * 3);
for(size_t i = 0; i < vertices->size(); ++i)
{
builder.add_vertex(Point3(vertices->at(i).x,
vertices->at(i).y,
vertices->at(i).z));
progBuildPolyh->StepProgress();
}
size_t vertexIndex = 0;
for(size_t i = 0; i < facetsSize; ++i)
{
builder.begin_facet();
builder.add_vertex_to_facet(triangleIndexs->at(vertexIndex));
++vertexIndex;
builder.add_vertex_to_facet(triangleIndexs->at(vertexIndex));
++vertexIndex;
builder.add_vertex_to_facet(triangleIndexs->at(vertexIndex));
++vertexIndex;
builder.end_facet();
progBuildPolyh->StepProgress();
}
builder.end_surface();
progBuildPolyh->StepProgress(); //Measuring stops
}
}
http://cgal-discuss.949826.n4.nabble.com/file/n3253686/screen_terrain_gen_0.jpg
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Cartesian.h> #include <CGAL/Polyhedron_3.h> #include <CGAL/HalfedgeDS_vector.h> #include <CGAL/HalfedgeDS_items_2.h> #include <CGAL/IO/Polyhedron_iostream.h> #include <CGAL/Real_timer.h> #include <fstream> typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC; typedef CGAL::Exact_predicates_exact_constructions_kernel EPEC; typedef CGAL::Cartesian<double> CD; typedef CGAL::Simple_cartesian<double> SCD; template <class Polyhedron> void bench(const char* fname,const char* info) { std::cout << info <<std::endl; CGAL::Real_timer time; time.start(); Polyhedron P; std::ifstream in(fname); in >> P; time.stop(); std::cout << "Build "<< time.time() <<"s." << std::endl; time.reset(); time.start(); P.clear(); time.stop(); std::cout << "Erase " << time.time() <<"s." << std::endl; } template <class Kernel> void run(const char* fname,const char* info) { typedef CGAL::Polyhedron_3<Kernel> Poly_list; typedef CGAL::Polyhedron_3<Kernel,CGAL::Polyhedron_items_3,CGAL::HalfedgeDS_vector > Poly_vector; std::cout << "Using " << info << std::endl; bench<Poly_list>(fname,"default, list-based"); bench<Poly_vector>(fname,"vector-based"); } int main(int argc, char** argv) { run<EPIC>(argv[1],"Exact_predicates_inexact_constructions_kernel"); run<EPEC>(argv[1],"Exact_predicates_exact_constructions_kernel"); run<CD>(argv[1],"Cartesian<double>"); run<SCD>(argv[1],"Simple_cartesian<double>"); return 1; }
- [cgal-discuss] Re: Slow Polyhedron Clear Time and Problems with Kernels, titan99, 02/02/2011
- [cgal-discuss] Re: Slow Polyhedron Clear Time and Problems with Kernels, titan99, 02/02/2011
- Re: [cgal-discuss] Re: Slow Polyhedron Clear Time and Problems with Kernels, Sebastien Loriot (GeometryFactory), 02/02/2011
- [cgal-discuss] Re: Slow Polyhedron Clear Time and Problems with Kernels, titan99, 02/03/2011
Archive powered by MHonArc 2.6.16.