[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Layout process of text, and sections
From:       "Dr. Robert Marmorstein" <robert () narnia ! homeunix ! com>
Date:       2010-02-03 4:33:27
Message-ID: 201002022333.27852.robert () narnia ! homeunix ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


> Basically, if you have a recursive structure that you want to traverse
> (which we do here), the only time you would chose an iterative approach is
> when your processor has very little stack space like in an embedded
> computer.  This is not what we are designing for in this case.

Okay, the academic in me couldn't help but jump in here with a comment.

Another reason to avoid recursion is that the overhead of calling a function 
(allocating a new stack frame, storing the return address, copying all the 
parameters onto the stack and popping them off again) makes function calls 
pretty expensive.  This means that an iterative solution is usually much 
faster than a recursive one.

From a theoretical perspective, anything that can be done using recursion can 
be done iteratively (possibly using a user-defined stack).  The advantage of 
recursion is that it can sometimes makes code more readable and compact, but 
these advantages vary from application to application.

I don't know how performance-critical layout pages is (I would assume this 
code is called pretty frequently?) but that could be another consideration in 
deciding which approach to use.

--Robert

["signature.asc" (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic