Re: [racket-users] Re: DrRacket becomes unresponsive when confronted with a long line

2017-06-27 Thread Robby Findler
I think that this is boiling down to an issue in the design of the
internal datastructures of the editor. Specifically, they use a linear
data structure to record each line and so very very long lines like
that are going to cause performance problems, generally speaking.
Below is an example program that is performing essentially the same
computation that typing a close paren at the end of that line performs
(not exactly hte same, but morally the same). Run it via the
command-line, e.g. `racket tmp.rkt` (if tmp.rkt contains the content
of that file).

You might try turning on word wrapping. That will make things
complete, but maybe not super quickly. Probably best to generate files
(assuming this one is a generated file?) with shorter lines. Removing
the semi-colon in the code below shows how that affects the
computation (for me, it goes from forever to maybe 14 seconds).

hth,
Robby

#lang racket/gui
(require framework)

(define f (new frame% [label ""] [width 500] [height 500]))
(define t (new text%))
(define ec (new editor-canvas% [parent f] [editor t]))
(send f reflow-container)
;(send t auto-wrap #t)

(send t load-file "drracket-problem-plain.rkt")
(define s1 (make-object style-delta% 'change-bold))
(define s2 (make-object style-delta% 'change-italic))
(time
 (let loop ([i 0]
[s1 s1]
[s2 s2])
   (when (zero? (modulo i 200))
 (printf "~a\n" (current-process-milliseconds)))
   (when (< i (send t last-position))
 (send t change-style s1 i (+ i 1))
 (loop (+ i 1) s2 s1




On Mon, Jun 26, 2017 at 10:28 PM, Philip McGrath
 wrote:
> I spoke too soon about continuing to edit as normal: actually, I can paste
> text and use backspace after the long line, but attempting to type anything
> further on in the file renders DrRacket unresponsive. Sometimes, when I
> "Force Quit" DrRacket (Mac OS), a DrRacket error window flickers onto the
> screen, but it's gone before I can read it.
>
> file->value for me, for now.
>
> -Philip
>
> On Mon, Jun 26, 2017 at 10:22 PM, Philip McGrath 
> wrote:
>>
>> When I open the attached file (which contains a very long line) in
>> DrRacket and attempt to type a closing parenthesis (either ")" or "]") on
>> line 4 (i.e. to close the define form), DrRacket becomes unresponsive until
>> forcibly killed (at least for several minutes, and even the caret stops
>> blinking). Interestingly, if I paste a closing parenthesis at that position,
>> I can continue editing as normal.
>>
>> I don't know if this is relevant, but when I attached
>> drracket-problem-file.rkt, I noticed it somehow wound up in the WXME format:
>> drracket-problem-plain.rkt is a plain-text version and appears to exhibit
>> the same issue.
>>
>> Thanks,
>> Philip
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: DrRacket becomes unresponsive when confronted with a long line

2017-06-26 Thread Philip McGrath
I spoke too soon about continuing to edit as normal: actually, I can paste
text and use backspace after the long line, but attempting to type anything
further on in the file renders DrRacket unresponsive. Sometimes, when I
"Force Quit" DrRacket (Mac OS), a DrRacket error window flickers onto the
screen, but it's gone before I can read it.

file->value for me, for now.

-Philip

On Mon, Jun 26, 2017 at 10:22 PM, Philip McGrath 
wrote:

> When I open the attached file (which contains a very long line) in
> DrRacket and attempt to type a closing parenthesis (either ")" or "]") on
> line 4 (i.e. to close the define form), DrRacket becomes unresponsive until
> forcibly killed (at least for several minutes, and even the caret stops
> blinking). Interestingly, if I paste a closing parenthesis at that
> position, I can continue editing as normal.
>
> I don't know if this is relevant, but when I attached
> drracket-problem-file.rkt, I noticed it somehow wound up in the WXME
> format: drracket-problem-plain.rkt is a plain-text version and appears to
> exhibit the same issue.
>
> Thanks,
> Philip
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.