Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.5
    • Fix Version/s: 0.7
    • Component/s: Compiler, Emitter
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Be able to turn off boo's array indexing normalization (that allows things like myarray[-1] like python), for speed purposes. See:
      http://groups-beta.google.com/group/boolang/browse_frm/thread/f9673a6dfca8727b/1732e48b82f859a3?q=array#1732e48b82f859a3

      This just adds simple macros. We can add a more general "options" macro or whatever later.

      """
      normalarrayindexing is working
      rawarrayindexing is working
      time to set 10000 array items using rawarrayindexing
      and then normalarrayindexing
      """

      myarray = (1,2,3)

      try:
      normalarrayindexing:
      myarray[-1] = 4
      print "normalarrayindexing is working"
      map(myarray,

      {x|print(x+" ")}

      )
      except e:
      print "error: you should not see me - normalarrayindexing is not working"

      try:
      rawarrayindexing:
      myarray[-1] = 5
      print "error: you should not see me - rawarrayindexing macro is not working"
      except e as System.IndexOutOfRangeException:
      print "rawarrayindexing is working"

      //time how long it takes to set 10000 array items with rawarrayindexing on
      a1 = array(int,10000)
      a2 = array(int,10000)
      start = date.Now

      i = 0
      while i < 10000:
      j = 0
      while j < 10000:
      rawarrayindexing:
      a1[i] = a2[j]
      ++j
      ++i

      end = date.Now
      print "T(raw) = " + (end-start)

      start = date.Now

      i = 0
      while i < 10000:
      j = 0
      while j < 10000:
      normalarrayindexing:
      a1[i] = a2[j]
      ++j
      ++i

      end = date.Now
      print "T(normal) = " + (end-start)

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Doug H
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: