RE: A truth? patch + benchmarks

From: "Christoph" <chr_news@...>
Date: 2002-08-02 07:12:45 UTC
List: ruby-core #285

> -----Original Message-----
> From: Yukihiro Matsumoto [mailto:matz@ruby-lang.org]
> Sent: Thursday, August 01, 2002 9:03 AM
> To: ruby-core@ruby-lang.org
> Subject: Re: A truth? patch + benchmarks
> 
> Hi,
> 
> In message "RE: A truth? patch  + benchmarks"
>     on 02/08/01, "Christoph" <chr_news@gmx.net> writes:
> 
> |>  Not really sure but the values < 64 reserved for T_MASK
> |>
> |> #define T_NIL    0x01
> |> #define T_OBJECT 0x02
> |> [etc]
> |> #define T_NODE   0x3f
> |>
> |> #define T_MASK   0x3f
> |
> |Hm, what about using FL_USER7? More generally, is there any
> |unused flag left?
> 
> Unfortunately, there's no bit available for all objects.  All flag
> bits are used to represent NODEs' line number.

To bad ... but maybe we might see something like it in 2.0? (or
even better body smatter cooks something up for the current 
development line - maybe only replace the RTEST calls in the
crucial IF_NODE, WHILE_NODE ...  part?)

> 
> By the way, I still don't know why the inlined function is faster than
> the simple macro.  Does anybody reveal the secret for me?

I don't know (besides a not particular helpful  ``your compiler
always knows best'' ;-). Anyway  I run the two tests (on Mswin32)
subdividing the macro call RTEST(v) following strategy c) (of
my previous post)

PURE_TEST(v) = .. original macro call for
            ruby_verbose and ruby_debug test.

and setting  the rest of the RTEST(obj) macro calls to


static inline int
rb_truth_test(VALUE obj)
{
  if (~Qnil & obj) return 1;
  return 0;
}


Not surprisingly, this version tested as fast or faster then
any of my other test candidates.



/Christoph

In This Thread