Skip to content

Conversation

@asmwarrior
Copy link
Collaborator

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

@JamesBremner
Copy link
Owner

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.

@asmwarrior
Copy link
Collaborator Author

asmwarrior commented Feb 2, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants