Why does DeltaTime slowly increase?

I was trying to use DeltaTime to stabilize a sound that played repeatedly in my test program. But I noticed that the value of DeltaTime increased slowly over time. I guess I don’t understand DeltaTime. I thought it’s value represented the time since the last time the Draw function was called. Moreover, the Draw function is supposed to get called once per frame. As an example, I have this simple code:

-- DeltaTime Test

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

    -- Do your drawing here

All I’m doing is printing DeltaTime. Yet, the output changes from 0.0000 to about 0.355 (in 5 minutes). It then goes to about 0.7655 in 10 minutes and moves to 1.012 after 15 minutes. Does this mean my simple program is steadily losing frame rate by just printing out DeltaTime? What am I missing here?

It is losing frame rate, unfortunately. This bug is fixed in 1.4.6, which I’m hoping will be approved soon.

Hey Simeon, I just downloaded 1.4.6 and I’m getting the same results. I don’t believe the fix worked (at least not on my iPad 2).

Hmm…is it possible that the loss in framerate over time could be a result of the console output buffer filling up and taking longer to print each frame? I’m not exactly sure how printing to the console is accomplished in Codea, but that doesn’t seem too far fetched. @Ric_Esrey: instead of calling print() every draw, have you tried using text() in your draw call to render the dt to the screen? I’d be curious to see if the framerate loss still occurs.

Actually it is the print() use. I should have caught that in the above code.

@Ric_Esrey: if you need to do a lot of console printing, especially printing once or more per frame, I recommend @mpilgrem’s print.redirect library here: http://twolivesleft.com/Codea/Talk/discussion/1371/redirecting-print-to-the-viewer#Item_15

It’s blazing fast, supports multiple output windows, and doesn’t seem to suffer from framerate loss (maybe if you left it running for a really long time, but I let it run for a quite a bit with no appreciable loss).

Console output buffer? :-?? I would have never figured that out (I don’t know how you guys do it). Anyway, it works the way you said. Thanks @Simeon and @toadkick.