[Coldstuff] .join() vrs. join()

Levi Pearson coldstuff@cold.org
Mon, 5 Aug 2002 16:18:09 -0600


On Mon, Aug 05, 2002 at 02:54:42PM -0700, Adam Cormany wrote:
> I understand everything you mean except for your
> example (foo.explode().join()). With this example,
> wouldn't it be faster or better to do
> join(explode(foo))?

The foo.explode().join() example makes use of native methods, which are
basically bindings in the database that point to the same code as the
join and explode functions.  The whole point of this is to fit the OOP
paradigm.  It lets you take advantage of polymorphism and other fun
stuff.  So it's faster to do join(explode(foo)), but less flexible.
Using the native methods is encouraged unless you determine the extra
overhead inside some tight loop is causing some significant slowdown.

Remember, premature optimization does more harm than good.  Design fast
code through good algorithms, then worry about optimizations in critical
sections that actually need to be faster.

		--Levi