WheretIB / LuaDkmDebugger

Visual Studio C++ debugger extensions for Lua
MIT License
81 stars 32 forks source link

Debugger freezes up trying to show a datatip for large Lua tables #3

Closed fsfod closed 4 years ago

fsfod commented 4 years ago

The debugger can get bogged down very slowly reading table values in LuaTable.LoadValues when trying to display data tip for large tables with several thousand values. This was the call stack it was happening in.

    LuaDkmDebuggerComponent.LuaTableData.LoadValues Line 1525   C#  Symbols loaded.
    LuaDkmDebuggerComponent.EvaluationHelpers.EvaluateValueAtLuaValue Line 224  C#  Symbols loaded.
    LuaDkmDebuggerComponent.EvaluationHelpers.EvaluateDataAtLuaValue Line 348   C#  Symbols loaded.
    LuaDkmDebuggerComponent.LocalComponent.Microsoft.VisualStudio.Debugger.ComponentInterfaces.IDkmLanguageExpressionEvaluator.GetItems Line 1649   C#  Symbols loaded.
    Microsoft.VisualStudio.Debugger.EntryPoint.IDkmLanguageExpressionEvaluator_GetItems Unknown No symbols loaded.

It would help to have some cut off when reading the values and all those single memory reads could maybe batch read from a single larger memory read thats cached in a byte buffer to speed things up.

WheretIB commented 4 years ago

Thank you for the suggestion.

I was able to reproduce the issue and I will try to improve this by using lazy evaluation/caching.

WheretIB commented 4 years ago

The original issue was fixed in 86ee12f2c512dbcb269c400a8b7e1477208c3c75

Additional improvements were made for table expression evaluation (process memory read batching, lazy evaluation for node keys and values)

I'm going to test these changes for a bit before I publish the extension update.

WheretIB commented 4 years ago

Fix for this issue has been published in 0.9.2 update of the extension.