Re: Speed: sprintf vs. & operator

new topic     » goto parent     » topic index » view thread      » older message » newer message

jc at cowgar.com wrote:

> What's quicker?
>   fullName = fn & " " & mn & " " & ln
> or:
>   fullName = sprintf("%s %s %s", {fn,mn,ln})
> ?

After a few tests I'm convinced the former is around 4 times faster than the
latter. Go with the ampersands :)

Hint:
  constant SP = ' '
  --
  -- other code
  --
  fullName = fn & SP & mn & SP & ln

...is faster still.

Carl
--
[ Carl R White -=- aka -=- Cyrek the Illogical ]
[ () E-mail...:     cyrek{}cyreksoft.yorks.com ]
[ /\ URL......: http://www.cyreksoft.yorks.com ]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu