Skip to content

Ising: use no-display instead of repeat to speed up model#131

Closed
nicolaspayette wants to merge 1 commit intomasterfrom
ising-no-display
Closed

Ising: use no-display instead of repeat to speed up model#131
nicolaspayette wants to merge 1 commit intomasterfrom
ising-no-display

Conversation

@nicolaspayette
Copy link
Copy Markdown
Member

I found a different way to speed up the Ising model: instead of using repeat 1000 and then ticks-advance 1000, I use no-display to turn off view updates and explicitly call display every 1000 ticks.

This is, in my opinion, a much less convoluted way to achieve the desired result. It also means that go runs once per tick instead of once every 1000 ticks, which is more intuitive.

@UriCCL, @arthurhjorth, @qiemem, what do you think? Unless someone has an objection, I will update the info tab accordingly and merge the changes.

(@UriCCL, here is the direct link for downloading the updated model if you want to check it out: https://raw.githubusercontent.com/NetLogo/models/ising-no-display/Sample%20Models/Chemistry%20%26%20Physics/Ising.nlogo )

@nicolaspayette nicolaspayette added this to the 5.2.1 milestone Sep 21, 2015
@nicolaspayette nicolaspayette self-assigned this Sep 21, 2015
@qiemem
Copy link
Copy Markdown
Member

qiemem commented Sep 21, 2015

Cool idea. There are advantages and disadvantages to both.

I think the repeat approach is easier to understand, since I doubt most novice netlogo programmers even realize that when to display stuff is something that you have to worry about, and there are no mod shenanigans. Being able to stop at any tick is nice (in the display approach), but the display won't actually update when you stop the model... so that kind of defeats the purpose.

Finally, not sure how much of a consideration this is, but NLW doesn't support display or no-display, so it would still be slowish on there.

I think I slightly prefer the repeat method, but could be convinced.

@nicolaspayette
Copy link
Copy Markdown
Member Author

the display won't actually update when you stop the model

You're right. That's a problem.

NLW doesn't support display or no-display, so it would still be slowish on there.

Also a very good point.

@SethTisue
Copy link
Copy Markdown
Collaborator

I think no-display should never be used in Sample Models, even if a particular case seems tempting — it is a historical relic and we want to reduce the probability of people stumbling on it or using it.

If you made Ising use it, it would be the only model in Sample Models to do so.

@nicolaspayette
Copy link
Copy Markdown
Member Author

it is a historical relic and we want to reduce the probability of people stumbling on it or using it.

I wasn't aware of no-display having such a status, but I think that pretty much settles it (and I'll close the PR without merging). Still, could you elaborate a bit on what's wrong with it?

@SethTisue
Copy link
Copy Markdown
Collaborator

99%, if not 100%, of uses in the past were to compensate for the nonexistence of tick-based updates in older NetLogo versions, or were just because people didn't understand they should be using tick-based updates instead.

It's also really hard to implement in a fully general way, so even before NLW existed, I was already looking ahead to future NL or NL-like engines that might not be capable of updating the display from arbitrary places in the code. There are pretty fundamental reasons it isn't in NLW currently and might never be in NLW — I think there's an issue somewhere with discussion on that.

@qiemem
Copy link
Copy Markdown
Member

qiemem commented Sep 21, 2015

NetLogo/Tortoise#13

@SethTisue
Copy link
Copy Markdown
Collaborator

Oh and I'll just throw one more thing on this: display and no-display are old names that aren't consistent with the way anything else in NetLogo is named.

@nicolaspayette
Copy link
Copy Markdown
Member Author

I understand. Thanks for the explanation.

Still, when using tick-based updates, it leaves NetLogo without a way to advance the tick counter without triggering a display update (since ticks-advance doesn't guarantee a display update but still requests one). 99.9% of the time, that's not a problem. In Ising, it would have been nice to have the option. But we can live with that! :-)

@SethTisue
Copy link
Copy Markdown
Collaborator

There is definitely a missing NetLogo feature here; see my comment at NetLogo/NetLogo#741.

@nicolaspayette
Copy link
Copy Markdown
Member Author

There is definitely a missing NetLogo feature here; see my comment at NetLogo/NetLogo#741.

Right. Allowing NetLogo to skip frames to hit the target frame rate would indeed fix our Ising problem without needing to resort to any repeat or no-display shenanigans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants