Skip to content

Speed of dtm.data() #17

@taylorbf

Description

@taylorbf

Hey there Taka,

DTM is usually pretty speedy -- for example, .rep(1000) or .rep(10000) create a lot of data and resolve in <10ms.

But I've noticed measurable delays when creating multiple dtm.arrays. For example --

    for (var i=0;i<1000;i++) {
         dtm.data(0)
    }

takes about 400ms to resolve for me, which is quite a bit of time, actually!

I know this is because creating a new dtm.array involves creating many new variables in different scopes, a lot of traversal, looping, etc.

But I wonder if you have advice on any way to make this take less time. Are there extensions of the dtm.array class which are rarely used, or disposable? Is there a way to create a "lightweight" dtm array with only the core methods? Or do you have ideas about an aspect of the code that might be causing the delay? I may do some hunting as well. : )

I ask because I am using dtm to create melodic patterns that are looped indefinitely. They use randomness so they need to be re-evaluated upon each loop. Therefore, I find myself creating a lot dtm arrays quite rapidly.

Sorry to keep bugging you. : ) This is not a time sensitive question -- respond at your liesure.

Project is going great. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions