Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] point lying over a line problem

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] point lying over a line problem


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] point lying over a line problem
  • Date: Wed, 23 Jul 2008 18:20:05 +0200

Alejandro Aragon a écrit :
By the way, talking about points in CGAL. I decided to create my own point class, templated by the dimension of the point to see the difference in creation time with that of the CGAL types. I introduced an implicit conversion so that I can use my point type where a CGAL algorithm needs it. Then my test was just creating points. It was surprising the time that it took the creation of 10e9 Point_2 objects compared to my simple templated point class:

int main(int argc, char *argv[]) {

typedef CGAL::Point_2 PointType;

Timer t1;
cout<<"CGAL point"<<endl;
t1.Reset();
for (long i=0; i<1.0e9; ++i) {
PointType p(3,5);
}
t1.Tac();
cout<<"my point"<<endl;
t1.Reset();
for (long i=0; i<1.0e9; ++i) {
geometry::Point<2> p(3,5);
}
t1.Tac();

exit(0);
}

$./a.out
CGAL point
Time: 74.2738sec
Measurement granularity: 1000000 of a second
my point
Time: 1.57362sec
Measurement granularity: 1000000 of a second

so can someone tell me why is this? I would never expect an almost factor of 50 in execution times! and this was just for creating a point.

Cartesian<> uses reference-counting, which obviously shows-up
in such a synthetic benchmark.
Try to compare with Simple_cartesian maybe?

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/



Archive powered by MHonArc 2.6.16.

Top of Page