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

current memory usage #350

Open
ghost opened this issue Jul 19, 2013 · 8 comments
Open

current memory usage #350

ghost opened this issue Jul 19, 2013 · 8 comments

Comments

@ghost
Copy link

ghost commented Jul 19, 2013

for 35 seconds:
(removed SPELL_DAMAGE for testing, so it doesn't shows up below)

Any ideas to lower the values? tested with the lowest updateInterval Value

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED::SPELL_HEAL: 0.31640625 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED: 9.2744140625 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 7.341796875 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 7.9814453125 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 7.7783203125 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 8.5888671875 KB in 5 seconds

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED: 8.044921875 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 6.509765625 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 7.080078125 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 6.296875 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 7.21875 KB in 5 seconds

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED::SPELL_HEAL: 0 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED: 8.2578125 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 7.0068359375 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 5.41796875 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 8.15625 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 5.373046875 KB in 5 seconds

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED::SPELL_HEAL: 0 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED: 8.796875 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 8.0888671875 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 4.3359375 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 7.15234375 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 4.3154296875 KB in 5 seconds

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED: 7.16015625 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 6.0830078125 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 6.1923828125 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 6.275390625 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 6.2841796875 KB in 5 seconds

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED: 9.6171875 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 9.515625 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 8.369140625 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 7.490234375 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 8.037109375 KB in 5 seconds

Memory Usage Report:
 * COMBAT_LOG_EVENT_UNFILTERED::SPELL_HEAL: 0 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED: 13.892578125 KB in 5 seconds
 * UNIT_HEALTH_FREQUENT: 13.791015625 KB in 5 seconds
 * UNIT_SPELLCAST_SUCCEEDED: 6.16015625 KB in 5 seconds
 * COMBAT_LOG_EVENT_UNFILTERED::SWING_DAMAGE: 13.619140625 KB in 5 seconds
 * UNIT_SPELLCAST_SENT: 8.7900390625 KB in 5 seconds
@kirk24788
Copy link
Contributor

Did you test on a Dummy, or in a raid? (The dummy is pretty hard on a populated server....lot's of events from hundreds of players...didn't have time to test in a raid unfortunately...
As far as UNIT_SPELLCAST_SUCCEEDED goes....my last pull request should reduce the amount wasted...

While those aren't good values...they aren't bad either...Some events overlap - so you cant bei 100% sure which event really increase the memory...(and this also leads to the conclusion that you can't just add all single values)

Maybe I should add a total memory increase within this 45 seconds interval....might be a good idea.

@ghost
Copy link
Author

ghost commented Jul 19, 2013

profiling crashed WoW after enabling in LFR :D

will post a comment after testing in LFR

EDIT:

and again , no way for profiling in 25 man raid :) :D

@kirk24788
Copy link
Contributor

Damned....maybe 5 second intervals was a little to enthusiastic...maybe 15 seconds are a better choice

@ghost
Copy link
Author

ghost commented Oct 27, 2013

any idea why the usage value is sometimes negative?

@kirk24788
Copy link
Contributor

Garbage Collection

@ghost
Copy link
Author

ghost commented Oct 30, 2013

so during the calculation a garbage collection started ?^^

@kirk24788
Copy link
Contributor

Well...it's the only rational explanation I got :D

I noticed this too...tried to figure it out, but didn't manage to....GC in Lua is strange....never found a good source on how it really works...it has a pretty bad GC (else tables wouldn't be so much of a problem)...Java is way better, but still...I really can't explain it...

@ghost
Copy link
Author

ghost commented Nov 5, 2013

currently I tested two similar functions in memoery usage & execution time and got interesting results.

functions:

keyDownMapper = {}
keyDownMapper["shift"] = IsShiftKeyDown
keyDownMapper["left-shift"] = IsLeftShiftKeyDown
keyDownMapper["right-shift"] = IsRightShiftKeyDown
keyDownMapper["alt"]= IsAltKeyDown
keyDownMapper["left-alt"] = IsLeftAltKeyDown
keyDownMapper["right-alt"] = IsRightAltKeyDown
keyDownMapper["ctrl"] = IsControlKeyDown
keyDownMapper["left-ctrl"] = IsLeftControlKeyDown
keyDownMapper["right-ctrl"] = IsRightControlKeyDown

function keyPressed(...)    
    local paramType = type(arrayOrString)
    matchesNeed = select("#", ...)
    matchesFound = 0
    i = 1
    print(select(i , ...))
    while select(i , ...) ~= nil  do
        needle = select(i, ...)
        i = i+1
        local apiFunction = keyDownMapper[needle:lower()]
        if apiFunction() ~= nil  then
            matchesFound  =matchesFound+1
            if matchesFound == matchesNeed then
                return true
            end
        end
    end
end

function keyPressed2(...)        
        local paramType = type(arrayOrString)
        matchesNeed = select("#", ...)
        matchesFound = 0
        for _, needle in pairs({...}) do
                local apiFunction = keyDownMapper[needle:lower()]
                if apiFunction() ~= nil then
                        matchesFound  =matchesFound+1
                        if matchesFound == matchesNeed then
                                return true
                        end
                end
        end

        return false
end

for 900000 iterations:

keyPressed1 uses the half of the memory of keyPressed2
keyPressed1 is about 4.7x times slower than keyPressed2

the big change is only the iteration method and while keyPressed1 does not create new tables, keyPressed2 does but it faster with this method.

While measuring memory I did a garbagecollect between the measurements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant