You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote the following straightforward code that prints a chessboard:
(set N 13)
(set board (array (list N N) \.))
(pr "ready now to print board" \lf)
(pr " ")
(for i 1 N
(pr " " (nchar (+ i 96))))
(pr \lf)
(for i 1 N
(for j 2 i
(pr " "))
(when (< i 10)
(pr " "))
(pr i " ")
(for j 1 N
(pr " " (board i j)))
(pr \lf))
(pr \lf)
Just now I also created a version of the script containing only the for loops. I'm running it now, timing it. The fact that I'm still typing these words as it continues to run shows how unacceptably slow for is right now.
(set N 13)
(for i 1 N)
(for i 1 N
(for j 2 i)
(for j 1 N))
I don't foresee any big issue in creating a fast operative for for. #412 doesn't mention it among the ones it decides to skip because it's hard.
Ah, here:
% time bel only-for-hex-board.bel
bel only-for-hex-board.bel 188.32s user 0.66s system 99% cpu 3:09.80 total
Three minutes. Yes, that would still be a really nice time win. Seems that would still leave 25 minutes for my hex board, but at least it wouldn't be the for loops' fault.
The text was updated successfully, but these errors were encountered:
I just created and ran a version of the code without the for loops but with all the rest of the code. It does indeed take 25 minutes. I'm now a little bit curious what it is that takes such time...
Some nchar calls
A bunch of board lookups
I made yet another version without these two, and that takes 1.6 seconds. So, yeah. Slow.
When I put back the nchar calls, I get 46 seconds. Which would assign ~24 minutes to the board lookups.
Looking into #200 for evidence of the slowness of arrays, I found a similar comment I had made about four months ago. But back then I wasn't using arrays, so I mostly got the three-minute slowdown of for loops.
I wrote the following straightforward code that prints a chessboard:
Guess how long it takes to run? 28 minutes!
Just now I also created a version of the script containing only the
for
loops. I'm running it now, timing it. The fact that I'm still typing these words as it continues to run shows how unacceptably slowfor
is right now.I don't foresee any big issue in creating a fast operative for
for
. #412 doesn't mention it among the ones it decides to skip because it's hard.Ah, here:
Three minutes. Yes, that would still be a really nice time win. Seems that would still leave 25 minutes for my hex board, but at least it wouldn't be the
for
loops' fault.The text was updated successfully, but these errors were encountered: