|
[jira] Commented: (BOO-484) For loop similar to Basic's for <var> = <start>: msg#00049lang.boo.devel
[ http://jira.codehaus.org/browse/BOO-484?page=comments#action_46080 ] Daniel Grunwald commented on BOO-484: ------------------------------------- Currently that optimization is not implemented. static void Test(int start, int max, int step) { Console.WriteLine("before loop"); for (int i = start; i < max; i += step) { Console.WriteLine(i); } Console.WriteLine("after loop"); } compiles to EXACTLY the same IL as def Method(start as int, end as int, step as int): Console.WriteLine("before loop") i = start while i < end: Console.WriteLine(i) i += step Console.WriteLine("after loop") So the "for i in range()" optimization can be done with simple pipeline step. > For loop similar to Basic's for <var> = <start> to <end> [step <step>]: > ----------------------------------------------------------------------- > > Key: BOO-484 > URL: http://jira.codehaus.org/browse/BOO-484 > Project: Boo > Type: New Feature > Environment: All > Reporter: Cameron Kenneth Knight > Priority: Minor > > > Boo's current for loop with range is much slower than C#'s simpler for loop > If we were to go with Basic's syntax of > for <var> = <start> to <end> [step <step>]: > <block> > Which, would give the same result as > for <var> in range(<start>, <end>[, <step>]): > <block> > but could be made a lot faster. > I ran a test where I, in C#, iterated through a for loop 1,000,000,000 times, > taking 1.75 seconds. > I then ran a test in Boo that iterated through its for loop using range > 1,000,000,000 times, taking 47.58 seconds. > I don't know if there is another way to make the for-range statement faster, > but the way I proposed can cut out the enumerator altogether. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [jira] Commented: (BOO-484) For loop similar to Basic's for <var> = <start> to <end> [step <step>]:, Cameron Kenneth Knight (JIRA) |
|---|---|
| Next by Date: | [jira] Commented: (BOO-484) For loop similar to Basic's for <var> = <start> to <end> [step <step>]:, Cameron Kenneth Knight (JIRA) |
| Previous by Thread: | [jira] Commented: (BOO-484) For loop similar to Basic's for <var> = <start> to <end> [step <step>]:, Cameron Kenneth Knight (JIRA) |
| Next by Thread: | [jira] Commented: (BOO-484) For loop similar to Basic's for <var> = <start> to <end> [step <step>]:, Cameron Kenneth Knight (JIRA) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |