@def, your version is 0.08 for me. My version is 0.05 ;) 
    
    
    import times, os
    
    const
      board = ['0', 'p', '.', 'p', 'P', '.', 'p', 'P', '.', 'p', '.', 'p', 'P', 
'.', 'p']
      NE = [8, 2, 13, 4, 5, 7, 8, 3, 9, 12, 7, 8, 3, 9, 12]
      Directions = [NE, NE, NE, NE]  # for short: in real application the array 
elements differ
    
    proc do_something(board: openarray[char]): seq[char] =
       result = newSeqOfCap[char](board.len * Directions.len)
       for i in 0 .. board.high:
          for d in 0 ..< Directions.len:
             result.add board[Directions[d][i]]
    
    let t0 = cpuTime()
    var res: seq[char]
    const count = 100000
    for i in 1..count:
       res = do_something(board)
    let t1 =  cpuTime()
    echo "***** Time elapsed for Nim: ", t1 - t0, "  Counts: ", count
    

Reply via email to