[PD] is there a [round]?

CK chris at lo-res.org
Wed Oct 12 14:01:35 CEST 2005


I read:
> thanks for the hints. how do you know [i] is faster than [div], or to 

because float to int conversion is simpler than actually dividing

compare:

static void binop3_div_bang(t_binop *x)
{
    int n1 = x->x_f1, n2 = x->x_f2, result;
    if (n2 < 0) n2 = -n2;
    else if (!n2) n2 = 1;
    if (n1 < 0) n1 -= (n2-1);
    result = n1 / n2;
    outlet_float(x->x_obj.ob_outlet, (t_float)result);
}

to

static void pdint_bang(t_pdint *x)
{
    outlet_float(x->x_obj.ob_outlet, (t_float)(int)(x->x_f));
}


> say it more precicely how much faster? which brings me to the thought, 
> that would it be possible to have a list of cpu-values/ranking for pd 
> objects?

the answer to both questions is that this might be quite different 
depending on architecture, compiler, os, library versions ....

> btw. is it faster to have a [bang( message or a [bng] gui?

definitely a [bang ( consumes less resources

HTH

x

-- 
chris at lo-res.org	Postmodernism is german romanticism with better
http://pilot.fm/	special effects. (Jeff Keuss / via ctheory.com)




More information about the Pd-list mailing list