Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: To-pair vs as-pair

From: rebol-list2:seznam:cz at: 3-Jan-2003 11:54

Hello Anton, Thursday, January 2, 2003, 1:24:52 AM, you wrote: A> Yes, as-pair is quite useful. A> Keep in mind that if you use these A> functions in a tight loop that draws A> some graphics, for example, you can A> get some speed by gutting the functions. A> Let's look at the sources:
>>> ?? as-pair
A> as-pair: func [ A> "Combine X and Y values into a pair." A> x [number!] y [number!] A> ][ A> to-pair reduce [to-integer x to-integer y] A> ] A> You can see that as-pair makes three mezzanine function calls. A> This will slow you down in a tight loop, so instead, A> you could just do everything yourself: A> to pair! reduce [to integer! x to integer! y] A> That will be much faster. When you are talking about that, I wonder why RT uses the slower to-pair and to-integer in such a functions... =( Oliva David )=======================( [oliva--david--seznam--cz] )== =( Earth/Europe/Czech_Republic/Brno )============================= =( coords: [lat: 49.22 long: 16.67] )=============================