

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
25 messages in org.ibiblio.lists.xom-interest[XOM-interest] Three cosmetic patches| From | Sent On | Attachments |
|---|---|---|
| Wolfgang Hoschek | Feb 9, 2004 6:42 pm | |
| Elliotte Rusty Harold | Feb 10, 2004 9:25 am | |
| Wolfgang Hoschek | Feb 10, 2004 3:23 pm | |
| jco...@reutershealth.com | Feb 10, 2004 3:48 pm | |
| Elliotte Rusty Harold | Feb 11, 2004 1:21 pm | |
| Wolfgang Hoschek | Feb 11, 2004 1:24 pm | |
| jco...@reutershealth.com | Feb 11, 2004 2:15 pm | |
| Elliotte Rusty Harold | Feb 11, 2004 3:18 pm | |
| jco...@reutershealth.com | Feb 11, 2004 4:20 pm | |
| Francois Beausoleil | Feb 11, 2004 8:08 pm | |
| Trimmer, Todd | Feb 12, 2004 11:57 am | |
| Elliotte Rusty Harold | Feb 12, 2004 2:53 pm | |
| Trimmer, Todd | Feb 13, 2004 1:26 pm | |
| Elliotte Rusty Harold | Mar 8, 2004 3:17 pm | |
| jco...@reutershealth.com | Mar 8, 2004 4:06 pm | |
| Elliotte Rusty Harold | Mar 8, 2004 4:34 pm | |
| Elliotte Rusty Harold | Mar 9, 2004 11:55 am | |
| Bradley S. Huffman | Mar 9, 2004 12:09 pm | |
| Elliotte Rusty Harold | Mar 9, 2004 1:05 pm | |
| jco...@reutershealth.com | Mar 9, 2004 2:04 pm | |
| jco...@reutershealth.com | Mar 9, 2004 4:32 pm | |
| Elliotte Rusty Harold | Mar 9, 2004 10:43 pm | |
| John Cowan | Mar 9, 2004 10:58 pm | |
| Elliotte Rusty Harold | Mar 10, 2004 6:12 am | |
| Dirk Bergstrom | Mar 10, 2004 6:25 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [XOM-interest] Three cosmetic patches | Actions... |
|---|---|---|
| From: | Wolfgang Hoschek (whos...@lbl.gov) | |
| Date: | Feb 11, 2004 1:24:15 pm | |
| List: | org.ibiblio.lists.xom-interest | |
If it is "tail recursion", then it usually does not matter. Optimizers can turn tail recursion (where the recursive call is the last instruction in the routine) into standard iteration.
"Usually" often does not apply to java compilers. Most java compilers won't actually do tail recursion transformations. You can check this yourself by running the snippet below. Tail recursion transformation would rewrite the recursion into "while (true) {}". If the program crashes with a StackOverflow the compiler does not do the optimization; if it continues infinitely without any problem the compiler does the optimization.
Results: sun-1.3.x, sun-1.4.x, sun01.5.0beta1 don't do tail recursion optimization (both for client and server vm). Only ibm-1.3.1 and ibm-1.4.1 do it.
public class TailRecursionTest {
private static int loop(int i) { return loop(i); }
public static void main(String[] args) { loop(0); } }
Francois Beausoleil wrote:
On Tue, 10 Feb 2004 12:24:04 -0800, "Wolfgang Hoschek" <whos...@lbl.gov> said: [snip]
benchmarks years ago is that iteration is always faster than recursion because it avoids function calls, stack allocations and deallocations,
[snip]
This depends on the recursive algorithm. If it is "tail recursion", then it usually does not matter. Optimizers can turn tail recursion (where the recursive call is the last instruction in the routine) into standard iteration. For that reason, it is usually better to use tail recursion than another recursion type.
I don't have the original code in front of me, so I can't say if it is tail recursion.







