Skip to content

Optimization: Preload world/cty data asynchronously at startup #1027

@ea4k

Description

@ea4k

Problem

World/prefix data is lazy-loaded synchronously on first use: World::ensureWorldLoaded() (src/world.cpp:64-70) calls readWorld(), which runs the database queries to populate the prefix/entity maps on the main thread the first time a callsign/prefix lookup happens.

Additionally, World::readCTYCSV() (src/world.cpp:568-673) parses cty.csv synchronously on the main thread when the country file is (re)loaded.

User-visible symptom

  • The first callsign the user types after starting KLog stalls the UI for ~0.5-2 s (worse on slow storage) while the world data loads.
  • Startup/first-run is delayed by several seconds when cty.csv is being parsed.

Proposed fix

  • Kick off world-data loading asynchronously right after the main window shows (e.g., QtConcurrent::run populating the maps, swapped in when ready), so the data is warm before the user types the first call.
  • Run cty.csv parsing in a worker thread as well; it already runs inside a transaction, so only the threading/connection handling needs work.

Lower priority than the other performance issues from the analysis, but a cheap fix for a poor first impression at every app start.

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