Skip to content

Speed up mapping of x,y to line number and column #48

@abegel

Description

@abegel

Looking at the source code in xml_writer.cs, there are some very easy ways to optimize this code to run much faster.

  1. Instead of System.Windows.Forms.Timer class, which is from the Stone Age of C#, use the System.Diagnostics.Stopwatch class to make a timer. (https://tekeye.uk/visual_studio/high-speed-regular-events-in-c-sharp). Timer can't go faster than every 16 ms.
  2. getVSData() should be executed in its own thread instead of in the event thread. Spawn the thread when this addin is loaded. Every time the timerTick goes off, push the x,y,timestamp data into a thread-safe queue. The thread can drain this queue and process the x,y location.
  3. Have the getVSData() function write its mapping (line number, column) into a thread-safe queue.
  4. Disk access doesn't need to be in the event thread. Have another thread drain the output queue and write XML to disk.

This should remove significant bottlenecks from the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions