[1174] in Coldmud discussion meeting

root meeting help first first in chain previous in chain previous next last

Re: [COLD] Performance notes

daemon@ATHENA.MIT.EDU (Wed Dec 4 12:08:52 1996 )

Date: Wed, 4 Dec 1996 09:54:22 -0700 (MST)
From: Brandon Gillespie <brandon@glacier.cold.org>
cc: coldstuff@cold.org
In-Reply-To: <199612041127.MAA17791@regoc.srce.hr>

On Wed, 4 Dec 1996, Miroslav Silovic wrote:
> 3) natives vs functions
> 
> Every native method call has to do full method lookup. It takes
> about 3x longer to execute a native than a function. So, be
> careful with them in tight loops.

This is sortof misleading :)

They are not 3x longer, they are a bit slower on startup than
functions--however once they start executing they are the same 'speed' as
functions as they are simply executing native C code.  The slower amount
on startup is in the 2-3 times range, but its measured in about a
hundred-thousandth of a second.  Using it in general is ok--but as he says
if its in a tightly executing loop where you want to optimize things,
using 'strlen(str)' over 'str.length()' will give you a few microseconds
more :)

-Brandon Gillespie