Archived issue #0008722
Optimization of StdPrs_ToolRFace::Next() method
Description
It is proposed to improve StdPrs_ToolRFace::Next() method, so as to avoid
unnecessary recursion.
********************
Original message posted by Ernest at www.opencascade.org forum:
http://www.opencascade.org/org/forum/thread_8054/
some optimization ( StdPrs_ToolRFace)
instead of
void StdPrs_ToolRFace::Next()
{
myExplorer.Next();
if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
if (myExplorer.Current().Orientation() == TopAbs_INTERNAL) Next();
if (myExplorer.Current().Orientation() == TopAbs_EXTERNAL) Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}
it looks much better as: (less stack usage)
void StdPrs_ToolRFace::Next()
{
myExplorer.Next();
if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
while (myExpolrer.More() && (myExplorer.Current().Orientation() ==
TopAbs_INTERNAL || myExplorer.Current().Orientation() == TopAbs_EXTERNAL))
myExplorer.Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}
at least i'd prefer the second code.
unnecessary recursion.
********************
Original message posted by Ernest at www.opencascade.org forum:
http://www.opencascade.org/org/forum/thread_8054/
some optimization ( StdPrs_ToolRFace)
instead of
void StdPrs_ToolRFace::Next()
{
myExplorer.Next();
if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
if (myExplorer.Current().Orientation() == TopAbs_INTERNAL) Next();
if (myExplorer.Current().Orientation() == TopAbs_EXTERNAL) Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}
it looks much better as: (less stack usage)
void StdPrs_ToolRFace::Next()
{
myExplorer.Next();
if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
while (myExpolrer.More() && (myExplorer.Current().Orientation() ==
TopAbs_INTERNAL || myExplorer.Current().Orientation() == TopAbs_EXTERNAL))
myExplorer.Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}
at least i'd prefer the second code.
Additional information
Documentation remark, added by Author 2005-06-07 08:40:05:
Changes:
StdPrs_ToolRFace::Next() was improved to avoid unnecessary recursion.
Changes:
StdPrs_ToolRFace::Next() was improved to avoid unnecessary recursion.
Public activity
6 archived notes
Participants are labeled by their role within this record.
Dear APV,
Please prepare testing workbench for attached :
Created an attachment (Attachment 1 (GZ))
Corrected source file
Commenter 1
Please prepare testing workbench for attached :
Created an attachment (Attachment 1 (GZ))
Corrected source file
Commenter 1
Dear Commenter 1,
Workbench KAS:dev:OCC8722-opt has been created and compiled on SUN and LIN.
Workbench KAS:dev:OCC8722-opt has been created and compiled on SUN and LIN.
Dear QAContact,
Please, test the workbench KAS:dev:OCC8722-opt and compare testing results of
workbenches KAS:dev:Products and KAS:dev:OCC8722-opt. Libraries for SUN and LIN
are available.
Please, test the workbench KAS:dev:OCC8722-opt and compare testing results of
workbenches KAS:dev:Products and KAS:dev:OCC8722-opt. Libraries for SUN and LIN
are available.
No regress in dev:OCC8722-opt regarding to Products on sun or lin.
Dear APV,
Please raise dev:OCC8722-opt to KAS:dev:ros
Commenter 1
Please raise dev:OCC8722-opt to KAS:dev:ros
Commenter 1
Dear Commenter 1,
Source file for fixing OCC8722 has been put to the queue KAS:dev:ros.
Source file for fixing OCC8722 has been put to the queue KAS:dev:ros.