Skip to content

Potential performance issues related to wxIdleEvent::RequestMore #13

@Blackgen

Description

@Blackgen

I think I've found an issue with the event handling for the indexing tasks.

void BrowserWindow::onPerformTaskEvt( wxIdleEvent& p_event ) {
Ensure::notNull( m_currentTask );
m_currentTask->perform( );
if ( !m_currentTask->isDone( ) ) {
m_progress->update( m_currentTask->currentProgress( ), m_currentTask->text( ) );
p_event.RequestMore( );

After each entry p_event.RequestMore( ); is called, which will eventually execute onPerformTaskEvt(..) again. This seems to take a lot of time.

As a hack I've added a for-loop to process more items on each call of the method.

void BrowserWindow::onPerformTaskEvt( wxIdleEvent& p_event ) { 
 Ensure::notNull( m_currentTask );
 
 for (size_t i = 0; i < 1000; i++)
 {
     m_currentTask->perform();
     if (m_currentTask->isDone()) {
         break;
     }
 }

 if ( !m_currentTask->isDone( ) ) {
     m_progress->update( m_currentTask->currentProgress( ), m_currentTask->text( ) );
     p_event.RequestMore( );
 }

This leads to a significant performance boost for the indexing/saving/loading tasks. Normally indexing takes multiple hours, with my hack it takes a few minutes.

This is only a hack, as I'm unexpirenced in cpp/wxwidgets

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions