Re: Missing in misc.e
- Posted by Pete Lomax <petelomax at bl?eyonder?co.uk> Jul 20, 2007
- 713 views
CChris wrote: > > Pete Lomax wrote: > > Put the new code in say minmax.e instead. > > True. However, <snip> Distribute an allinc.e as per JL's suggestion then. > > constant FMM_MIN = 2, <snip> > > Why not, the declarations won't really hurt, but since these constants are > local to the file, why bother? They make the code far more readable. They follow the same conventions used by all the existing standard includes, eg see M_ALLOC etc in machine.e. > > > type nonmts(object s) As someone else noted, that should probably be non_empty_sequence(). > > if sequence(s) then > > if length(s) then return 1 end if > > end if > > return 0 > > end type > > > > This type has no side effect and will be skipped in translated code I > think. What exactly do you mean by that? I gather that is technically true, but I fail to see any reason why you would suddenly say that... > > Isn't }}} <eucode>return compare(s,{})=1</eucode> {{{ a simpler, faster > implementation? HUH??!! <scratches head> Oh, I see now, but I would comment it:
type non_empty_sequence(object s) integer c c = compare(s,{}) -- c is now -1 if s is an atom, -- 0 if s is {}, -- +1 if s is sequence of length 1 or more. return c=1 end type
<SNIP> > Using arguments internally isn't good for performance, since arguments are > set to no_value once on entry and once on exit of a routine. Actually I > was thinking about going exactly the other way, defining a local > input_string variable, setting it in each routine and passing no arguments > to find_bound(). Chris, there is a limit. Next you'll be stripping all comments and whitespace to shave 3 nanoseconds off load time. For better performance you would implement these as new opcodes instead of Eu code anyway. Also I suspect the and_bits() calls add at least 4 times what parameters would. What timing tests have you run, if any, and what actual results does your above mentioned change actually gain? > That's how get.e does its thing after all.. Not really for the same reason, rather to avoid having to pass the string to Get(), get_number(), get_string(), get_qchar(), skip_blanks(), and getch(). Regards, Pete