flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 |
Author |
|
Borsuc 30 Jul 2008, 19:47
f0dder wrote: how deep recursion would you need to traverse a balanced binary tree with 2^32 nodes? ![]() |
|||
![]() |
|
neville 30 Jul 2008, 21:18
WOW! This has developed into a very thought-provoking debate. I've learned a lot already, and it would be really good if somebody would take up the challenge. Tomasz? or f0dder? or comrade? Just choose any piece of recursive FASM code you like...
Programming is my hobby, not my profession, and mostly I have taught myself. The only programming class I ever attended was a night-school hobby class about the "new" 6800 microprocessor back in 1979, 29 years ago now. (that's not a typo - 6800, not 68000!) But that class captured my imagination and I've been programming on and off ever since. The following year in 1980 I bought my first computer - a Z80-based machine with 16K of main RAM and 2K of video RAM... yes, kilobytes! That machine used cassette tapes for mass storage, and I wrote a kind of a Tape Operating System for it in asm. Not really enough RAM for a viable memory operating system back then... I will admit I've never really thought about recursion v. iteration much before this thread - I guess I always thought that recursion was a nice "abstract" idea, but generally bad for practical reasons which have been discussed here. But maybe there are some good reasons to use it after all? I'm ready to be convinced, and Tom's Challenge could do it! Abuashraf, I wonder if you're still following this thread? It was your "putc" routine that started all this... It would be good to know what you think... _________________ FAMOS - the first memory operating system |
|||
![]() |
|
abuashraf 01 Aug 2008, 01:41
Quote: Abuashraf, I wonder if you're still following this thread? It was your "putc" routine that started all this... It would be good to know what you think... I'm reading this thread,and I learnt alot from it... |
|||
![]() |
|
iic2 01 Aug 2008, 20:43
Quote: I'm reading this thread,and I learnt alot from it... Me 2... What a great debate from the worlds greatest... Macros, recursive and other fine asm programming ideas is what bitRATE specialized in long before coming to fasm. Dealing with THE SVIN, f0dder and many other TODAY'S experts... catching on and exceeding in modern day asm programming for all and any OS in view at that moment. Sharing, breaking down facts to the bare bone core is what he learn how to do under these great friends and educators... Never, ever, over look his thoughts, no mater what ... Here is a piece of the world bitRAKE came from and help create ... http://www.asmcommunity.net/board/index.php?topic=10554.0 Now let the real code war began... |
|||
![]() |
|
MCD 13 Aug 2008, 14:34
neville wrote:
sure, using recursions for factorials seems dumb, and using a (naive) kind of recusion for fibonacci numbers would seem even more dumb, since you would need approximately 2^n stack words when you wanted to calculate the n-th fibonacci number, which is just unfeasible. But have you seen languages like Haskell? http://en.wikipedia.org/wiki/Haskell_(programming_language) neville wrote:
true neville wrote:
Ever tried to implement a quicksort without using recursion? It's a pain in the arse, because you got 2 possibilities to rebuild the recursive call tree: 1.) remodel the call stack outside of the CPU-stack and make the calls iteratively 2.) save current CPU-stack, and rebuild with it the call stack, and also make the calls iteratively neville wrote: except maybe in some fancy game graphics, eh bitRAKE nope, most game graphics routines have a fairly simple code structure. You mostly have basic linear algebra, iterative loops and maybe some hardware optimisations, which all have a quiet simple code structure. Of course there are some exceptions like recursive tesselation or recursive reflexions and iterated line/segment generations, but these are quiet uncommon, very special and often can be made fully recursion free. _________________ MCD - the inevitable return of the Mad Computer Doggy -||__/ .|+-~ .|| || |
|||
![]() |
|
bitRAKE 14 Aug 2008, 00:58
The_Grey_Beast wrote:
The whole idea that recursion is prone to stack overflow or implies openendedness is absurd and founded in incorrect implementations / understanding. If the maximum file path is 256 characters then how deep can a file be? Less than 126 directories, and how extreme is the upper bound here! How much optimization should be invested in marginal cases when the recursive solution favors the comon mode of execution and allows for marginal cases at reduced performance. Recursion is a form of execution compression. Often it is data driven, and it is the data which assures termination and bounds stack depth. Recursion is infinite descent, but a contradiction makes it finite. Like Darwin's "descent with modification" - survival of the fittest is modern egoism and a contradiction which will make us finite! It isn't enough to optimize an algorithm in isolation -- we also need to look at use cases and how it works within program as a whole. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
![]() |
|
Borsuc 14 Aug 2008, 11:28
MCD wrote:
![]() Let me say this again: classical recursion is bad -- i.e where you CALL a function to perform the recursion, rather than JUMP to it. It's completely unnecessary to push the address, even if you only push maximum of 2, it's still UNNECESSARY. "Significance" is completely SUBJECTIVE. I'm not talking about that. I'm only saying it is UNNECESSARY. and I don't know anything more objective than that ![]() |
|||
![]() |
|
Goto page Previous 1, 2, 3 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.