brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 110 forks source link

Programs with lots of test output should show incremental feedback #730

Open jpolitz opened 8 years ago

jpolitz commented 8 years ago

This program:

https://pyret-horizon.herokuapp.com/editor#share=0B32bNEogmncObTZnZzhDd0FfaDA

Runs fine on regular CPO, but hangs on horizon after printing results (presumably while formatting check results or errors).

It's tough to tell if it's an infinite loop or if it's just taking a really long time, but the page is completely unresponsive while it's doing whatever it's doing.

blerner commented 8 years ago

It's not an infinite loop. I just commented out most of the tests (20 choose 17 is 1140 tests, and 10 choose 6 is another 210), and the remaining tests worked fine. I think the problem is that @jswrenn's fancy mini-codemirror snippet rendering takes a damn long time to complete: it's busy building up a very large piece of DOM, and none of it is initially visible. Worse, since it involves appending to a DOM, and there are pixel-measurements being made in the CM layout, it's also possible that you're getting quadratically bad performance. I suspect that if those renderings were built up lazily (see below), this wouldn't be a perf issue. Note that because CM is doing so much work, Pyret's stack management has no influence here.

Suggestions for laziness:

I picked the number 10 as a guesstimate of how many tests can be rendered quickly and at most how many tests are likely to show up in student test programs (to start with). The setTimeout gives control back to the browser so you don't get unresponsive-script errors...

Assigning to @jswrenn, since this seems tightly coupled to his work.

schanzer commented 8 years ago

Using CPO, it takes about 10-15sec on my 2013 Macbook Air. Is this acceptable? With that number of tests, I can certainly live with it...

shriram commented 8 years ago

If it appears to be an infinite loop, that's bad enough. Not close for now.

schanzer commented 8 years ago

If there are more than n tests, I wonder if it would be possible to display some status indicator counting down...