DXF_Viewer icon indicating copy to clipboard operation
DXF_Viewer copied to clipboard

Spline display performance in the wxWidgets port #53

Open asmwarrior opened this issue 11 months ago • 2 comments

remove the dead if condition code, and make the code more compact

asmwarrior avatar Feb 02 '25 02:02 asmwarrior

Yow wrote:

When using the old code, the draw time of a big dxf(9M byte size) file is a bout 76ms, while for using the DrawLines(), it takes about 73ms, so 3% improvements, maybe they are just the same.

I am surprised that you see no improvement. If DrawLines() is properly implemented it should halve the amount of data transferred to the graphics card. Suggest you take a look at the wxWidgets code.

Does not seem to be worthwhile doing this pull.

JamesBremner avatar Feb 02 '25 02:02 JamesBremner

I looked at the source code of wxWidgets, for the old draw line code:

https://github.com/wxWidgets/wxWidgets/blob/969c5a46b5c1da57836f721a4ce5df9feaa437f9/src/msw/dc.cpp#L709-L743

https://github.com/wxWidgets/wxWidgets/blob/969c5a46b5c1da57836f721a4ce5df9feaa437f9/src/msw/utilsgui.cpp#L205-L209

So, it use LineTo(hdc, x2, y2); command.

For the new draw lines function code, it internally use the draw polyline function:

https://github.com/wxWidgets/wxWidgets/blob/969c5a46b5c1da57836f721a4ce5df9feaa437f9/src/msw/dc.cpp#L886-L914

I tested for several times, it looks like their performances are nearly the same.

Some discussion here: visual c++ - Performance difference between DrawLine and DrawLines? - Stack Overflow

Just out of curiosity, I tried regular GDI, which I expect would be faster. Using the win32 PolyLine() (530ms) function was about 20% faster, with 45000 lines.

asmwarrior avatar Feb 02 '25 03:02 asmwarrior