How to make wxgrid::AutoSizeColumns more effective? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
bulue
Knows some wx things
Knows some wx things
Posts: 25
Joined: Fri Apr 19, 2013 3:07 pm

How to make wxgrid::AutoSizeColumns more effective?

Post by bulue »

Hi.I used wxgrid to to develop a sql tool.But i found that when i select a large number of data insert a grid,it's not effective.

1.I select * from a table from database.The result contain 1000 rows and 51 column.The sql execution takes 0.00 second.
2.Insert all data to the grid.It takes about 0.80 second.
3.But after that i call grid->AutoSizeColumns(). It takes about 3.54 second!!!!

How to make my program running fast?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to make wxgrid::AutoSizeColumns more effective?

Post by doublemax »

Sounds normal. This function needs to call wxDC::GetTextExtent() for every single cell, that takes its time.

Are you using a release build with compiler optimizations already? If not, that could make a huge difference.
Use the source, Luke!
bulue
Knows some wx things
Knows some wx things
Posts: 25
Joined: Fri Apr 19, 2013 3:07 pm

Re: How to make wxgrid::AutoSizeColumns more effective?

Post by bulue »

Oh,I tried the release build ,it just takes 0.50 sec!It's so fast!Thank you,doulbemax.
Post Reply