Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
<!-- Add all new changes here. They will be moved under a version at release -->
* `FIX` --check now respects ignoreDir setting

## 3.13.3
* `CHG` Update Love2d version
Expand Down
2 changes: 1 addition & 1 deletion script/cli/check_worker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ xpcall(lclient.start, errorhandler, lclient, function (client)
local max = #uris
table.sort(uris) -- sort file list to ensure the work distribution order across multiple threads
for i, uri in ipairs(uris) do
if (i % numThreads + 1) == threadId then
if (i % numThreads + 1) == threadId and not ws.isIgnored(uri) then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be improved by removing them from uris[] first before the forloop.

  • Otherwise the workload distribution might be slightly unbalanced
  • because one of the threads will just ignore one round of the distributed task
        local uris = files.getChildFiles(rootUri)
        for i = #uris, 1, -1 do
            if ws.isIgnored(uris[i]) then
                -- remove by swapping with last element
                uris[i] = uris[#uris]
                uris[#uris] = nil
            end
        end
        local max  = #uris
        table.sort(uris) -- sort file list to ensure the work distribution order across multiple threads

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered this, but I don't think this makes a significant difference, the balancing is more affected by file complexity/size than ignoring. Also, since they are sorted by prefix it is likely that a whole contiguous range of files will be ignored, distributing the ignoredness over all workers

Copy link
Copy Markdown
Contributor

@tomlau10 tomlau10 Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this makes a significant difference, the balancing is more affected by file complexity/size than ignoring.

I totally agree with this.
But since now you are now trying to modify the logic of this part, why not make it perfect? 😂

I know that this whole multi thread check feature is implemented by you, and that's really awesome. 👍
In your initial implementation you used filename hash to distribute the tasks, which leads to slightly imbalanced distribution.
Maybe at that time you had also considered that and thought that won't make significant difference.
But in fact I changed it to simple round robin here #2738, and it yields a 10% performance 😄 .


Again I agree that my suggestion will probably not make a significant difference.
But isn't that removing ignored uris first is a more correct implementation? 😕
And if you find my current suggested change would make the logic a bit messy, I have come up with another suggestion

  • change the files.getChildFiles() to add a excludeIgnored optional boolean param
  • inside that logic add one more filter condition
    function m.getChildFiles(uri)
    local results = {}
    local uris = m.getAllUris(uri)
    for _, curi in ipairs(uris) do
    if #curi > #uri
    and curi:sub(1, #uri) == uri
    and curi:sub(#uri+1, #uri+1):match '[/\\]' then
    results[#results+1] = curi
function m.getChildFiles(uri, excludeIgnored)
    local ws = require "workspace"
...
        and (not excludeIgnored or not ws.isIgnored(curi)) then
  • then finally you can just use it like local uris = files.getChildFiles(rootUri, true) 👀

files.open(uri)
diag.doDiagnostic(uri, true)
-- Print regularly but always print the last entry to ensure that logs written to files don't look incomplete.
Expand Down