Ticket #133 (closed enhancement: fixed)
Optimization: Make "for i in c" as fast as "for i = 0 .. c"
Reported by: | Chuck | Owned by: | Chuck |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | optimization | Cc: |
Description
If possible, make the new, approved
for i in c
loop as fast as the old, deprecated
for i = 0 .. c
loop -- without breaking any semantics, of course!
The new loop is about 2 X slower than the old according to this program:
use System.Diagnostics class P def main is shared count = 2_000_000_000 sw = Stopwatch() trace Stopwatch.isHighResolution sw.start for i = 0 .. count pass sw.stop t1 = sw.elapsedMilliseconds print t1 sw.reset sw.start for j in count pass sw.stop t2 = sw.elapsedMilliseconds print t2 print t2 / t1, ' X slower'
Attachments
Change History
Note: See
TracTickets for help on using
tickets.