Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reserve time for each action in login thread #5174

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

emptyrivers
Copy link
Contributor

the times selected are completely arbitrary. The primary reason for this is to make WA liable to defer Resume() until the next frame, if AddMany() takes a decent chunk of time (usually due to migrations).

A user who's really determined can still defeat this strategy by importing so many auras that Resume() itself takes > 19 seconds to execute, but there's very little we can do about that anyways.

Closes #5172 (not by fixing it, but by making it less likely)

@emptyrivers emptyrivers added 🎨 Enhancement This pull request implements a new feature. 🏃 Performance Issue This issue concerns the performance impact of WeakAuras. 🆕 Feature Preview This is a draft intended to show a preview of an upcoming feature. labels Jun 21, 2024
Copy link

github-actions bot commented Jun 21, 2024

An experimental build of WeakAuras with the changes in this pull request is available here.
Build Time: Thu Jul 4 16:34:29 UTC 2024

@Desik
Copy link

Desik commented Jun 21, 2024

I tested the experimental build and I keep getting the same error

1x WeakAuras/WeakAuras.lua:1301: script ran too long [string "@WeakAuras/WeakAuras.lua"]:1301: in function Login'
[string "@WeakAuras/WeakAuras.lua"]:1389: in function <WeakAuras/WeakAuras.lua:1337>

Locals:
initialTime = 15000
takeNewSnapshots = true
loginThread =
startTime = 240853857.499900
finishTime = 240864908.433600
ok = true
val = nil
timeForNextStep = 1000
(*temporary) = true
(*temporary) = nil
(*temporary) = true
(*temporary) = true
(*temporary) = nil
(*temporary) = "script ran too long"
Private =

{
HandleGlowAction = defined @WeakAuras/WeakAuras.lua:3619
frame_strata_types =
{
}
DisplayToString = defined @WeakAuras/Transmission.lua:357
combat_event_type =
{
}
regions =
{
}
frameLevels =
{
}
CheckItemSlotCooldowns = defined @WeakAuras/GenericTrigger.lua:3166
InitializeEncounterAndZoneLists = defined @WeakAuras/Types_Cata.lua:13
IsEnvironmentInitialized = defined @WeakAuras/AuraEnvironment.lua:200
form_types =
{
}
CleanArchive = defined @WeakAuras/History.lua:25
UpdateProgressFrom = defined @WeakAuras/RegionTypes/RegionPrototype.lua:567
RunConditions = defined @WeakAuras/Conditions.lua:840
tooltip_count =
{
}
SmoothStatusBarMixin =
{
}
pet_spec_types =
{
}
regionOptions =
{
}
get_zoneId_list = defined @WeakAuras/Types_Cata.lua:75
checkForSingleLoadCondition = defined @WeakAuras/Prototypes.lua:1224
author_option_classes =
{
}
grid_types =
{
}
non_transmissable_fields =
{
}
absorb_modes =
{
}
combatlog_spell_school_types_for_ui =
{
}
miss_types =
{
}
CancelDelayedTrigger = defined @WeakAuras/GenericTrigger.lua:944
centered_types_h =
{
}
ensurePRDFrame = defined @WeakAuras/WeakAuras.lua:5437
talent_types =
{
}
LoadFunction = defined @WeakAuras/AuraEnvironment.lua:652
reset_swing_spells =
{
}
spec_types_all =
{
}
player_target_events =
{
}
FinishLoadUnload = defined @WeakAuras/WeakAuras.lua:2067
subRegionTypes =
{
}
UnregisterAllEveryFrameUpdate = defined @WeakAuras/GenericTrigger.lua:1884
array_entry_name_types =
{
}
eclipse_direction_types =
{
}
StringToTable = defined @WeakAuras/Transmission.lua:301
RegisterLoadEvents = defined @WeakAuras/WeakAuras.lua:1913
GetReputationsSorted = defined @WeakAuras/Types.lua:1712
blend_types =
{
}
text_automatic_width =
{
}
EnforceSubregionExists = defined @WeakAuras/RegionTypes/RegionPrototype.lua:1125
CheckSpellCooldown = defined @WeakAuras/GenericTrigger.lua:3022
custom_trigger_types =
{
}
group_types =
{
}
subRegionOptions =
{
}
GetProgressValueConstant = defined @WeakAuras/WeakAuras.lua:3930
text_rotate_types =
{
}
spec_types =
{
}
anim_ease_types =
{
}
item_slot_types =
{
}
multiUnitUnits =
{
}
anim_color_types =
{
}
loaded =
{
}
Convert = defined @WeakAuras/WeakAuras.lua:2284
sound_channel_types =
{
}
CheckCooldownReady = defined @WeakAuras/GenericTrigger.lua:3224
event_prototypes =
{
}
NeedToRepairDatabase = defined @WeakAuras/WeakAuras.lua:2361
AtlasList =
{
}
RegisterRegionType = defined @WeakAuras/WeakAuras.lua:413
classification_types =
{
}
GetCurrencyListSize = defined =[C]:-1
unit_types_bufftrigger_2 =
{
}
IsOptionsProcessingPaused = defined @WeakAuras/WeakAuras.lua:1589
ValueFromPath = defined `

WeakAuras/WeakAuras.lua Outdated Show resolved Hide resolved
WeakAuras/WeakAuras.lua Outdated Show resolved Hide resolved
@Desik
Copy link

Desik commented Jun 22, 2024

I tested the last artifact and got an error again

1x WeakAuras/WeakAuras.lua:4377: script ran too long [string "@WeakAuras/WeakAuras.lua"]:4377: in function <WeakAuras/WeakAuras.lua:4363> [string "@WeakAuras/WeakAuras.lua"]:4397: in function Immediate'
[string "@WeakAuras/WeakAuras.lua"]:1296: in function `Login'
[string "@WeakAuras/WeakAuras.lua"]:1370: in function <WeakAuras/WeakAuras.lua:1318>

Locals:
pool =

{
login =
}
finish = 276505524.720800
defaultEstimate = 1000
start = 276490524.721600
estimates =
{
login = 5
}
ok = true
val = 5
continue = true
(for generator) = defined =[C]:-1
(for state) =
{
login =
}
(for control) = "login"
name = "login"
thread =
estimate = 5
(*temporary) = true
(*temporary) = 5
(*temporary) = true
(*temporary) = 5
(*temporary) = true
(*temporary) = "script ran too long"
debugprofilestop = defined =[C]:-1
debugstack = defined =[C]:-1
threads =
{
normal =
{
}
SetPriority = defined @WeakAuras/WeakAuras.lua:4338
instant =
{
}
urgent =
{
}
Remove = defined @WeakAuras/WeakAuras.lua:4348
Immediate = defined @WeakAuras/WeakAuras.lua:4395
Add = defined @WeakAuras/WeakAuras.lua:4324
background =
{
}
frame = Frame {
}
prios =
{
}
size = 1
}`

@@ -2615,7 +2599,7 @@ function Private.AddMany(tbl, takeSnapshots)
oldSnapshots[data.uid] = Private.GetMigrationSnapshot(data.uid)
end
Private.SetMigrationSnapshot(data.uid, data)
coroutine.yield()
coroutine.yield(500)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be too low

we now have the capacity to suggest the relative importance of a given thread. A thread can be:
- urgent, meaning it will run every frame for 15 seconds before relinquishing control
- normal, meaning it will run every frame for 20 milliseconds
- background, meaning it will run every frame for at most 2 milliseconds

Login thread is the only thread expected to be urgent, as the experience of spillover from loading screen into contentful frames kind of sucks. background priority is currently unused, though migrating snapshots & spell cache to background priority threads seems appealing

additionally, add capability for threads to indicate how much time the next action will probably take
thread runner will use that time estimate to determine if it should defer the next action until the next frame
default is 1000 ms for urgent threads, 1 ms for normal threads, and 0.5 ms for background threads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 Enhancement This pull request implements a new feature. 🆕 Feature Preview This is a draft intended to show a preview of an upcoming feature. 🏃 Performance Issue This issue concerns the performance impact of WeakAuras.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5.14 Error: script ran too long on first login
3 participants