Questions about working on DrRacket and gui

217 views
Skip to first unread message

Dexter Lagan

unread,
May 1, 2020, 10:59:37 AM5/1/20
to Racket Users
Hi,

  I apologize in advance if my questions are naïve or have been asked previously. I read the 'Building Racket from Source' guide and couldn't find answers to some specific questions. I'm new to Git.

  I'd like to download DrRacket's source and profile it, say to improve scrolling performance or track this post-startup lock-up :
- Do I need to download the entire Racket tree in order to build DrRacket?
- Is the DrRacket's built-in profiler solid enough to handle profiling DrRacket itself?
- Modules in DrRacket's repo don't always have very telling names. Is there a document describing what each module does?
- If I make a change to a source file on my system, yet somebody else modifies the same file on their local system. Say both of our changes are accepted by whoever manages commits, how will accepted changes to the code merged?

  Also, say I have a suggestion regarding how DrRacket handles compiling standalone executables, do I still need to create an issue on its Github? For work I compile to standalone all day long, and I really wish DrRacket didn't zip the resulting file (it would be better to have the .exe file in an automatically created /bin or /output folder). Zipping the file takes time, and I have to unzip it each time, which takes more time, this piles up when done every few minutes, all day long. I could use raco exe, but I'd rather stay in DrRacket, and I'm sure many people would rather have the default behavior to not zip, just to have single responsibility on the compile function.

 One last questions: I have encountered differences in the behavior of macros between the REPL, a launcher and a standalone executable for distribution. Is there a document outlining the deeper differences between these three ways of executing Racket code?

Have a great weekend, wherever you're confined,

Dexter

Sorawee Porncharoenwase

unread,
May 1, 2020, 11:03:38 AM5/1/20
to Dexter Lagan, Racket Users
Sam just suggested me in the other email thread that a much easier way to do things is to download and install Minimal Racket, then install DrRacket from source.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CACUENr%2B%3Drr87rehZHQyDX%2BusXBZHdCY_46-pkKTuotj6HRwffg%40mail.gmail.com.

Dexter Lagan

unread,
May 1, 2020, 12:15:05 PM5/1/20
to Sorawee Porncharoenwase, Racket Users
  Thanks I’ll look into this.

Dex

On May 1, 2020, at 5:03 PM, Sorawee Porncharoenwase <sorawe...@gmail.com> wrote:



Matthew Flatt

unread,
May 1, 2020, 4:10:06 PM5/1/20
to Dexter Lagan, Racket Users
At Fri, 1 May 2020 16:59:22 +0200, Dexter Lagan wrote:
> I'd like to download DrRacket's source and profile it, say to improve
> scrolling performance or track this post-startup lock-up :

Does the start-time delay happen if you just type a number and hit
return, as opposed to typing an identifier? If not, the delay is
probably in loading documentation as triggered the first time DrRacket
sees an identifier to look up.

> - Do I need to download the entire Racket tree in order to build DrRacket?

You can start with minimal Racket and install DrRacket, as Sorawee
said, but be aware that installing DrRacket will pull in most of a
normal Racket distribution, anyway.

> - Is the DrRacket's built-in profiler solid enough to handle profiling
> DrRacket itself?

Running DrRacket inside of DrRacket is not likely to give you useful
information for something like scrolling, because DrRacket shares the
GUI instance with programs that it runs.

Running DrRacket with `raco profile` is more promising. It doesn't work
as easily as it should, partly because DrRacket wants to be in control,
and partly because `raco profile` doesn't deal with the custodian being
changed or waiting for a GUI program to exit. But I was able to run it
by supplying this wrapper program to `raco profile`:

#lang racket/base
(require racket/gui/base)

(define c (make-custodian))
(define done (make-semaphore))

(parameterize ([current-custodian c])
(parameterize ([exit-handler
(lambda (v)
(semaphore-post done)
(custodian-shutdown-all c))])
(define e (make-eventspace))
(parameterize ([current-eventspace e])
(queue-callback (lambda ()
;; here's where we finally start DrRacket
(dynamic-require 'drracket #f))))))

(sync done)


> - Modules in DrRacket's repo don't always have very telling names. Is there
> a document describing what each module does?

There's nothing like that, as far as I know.

> - If I make a change to a source file on my system, yet somebody else
> modifies the same file on their local system. Say both of our changes are
> accepted by whoever manages commits, how will accepted changes to the code
> merged?

We use Git, which provides good tools for merging changes.

> Also, say I have a suggestion regarding how DrRacket handles compiling
> standalone executables, do I still need to create an issue on its Github?
> For work I compile to standalone all day long, and I really wish DrRacket
> didn't zip the resulting file (it would be better to have the .exe file in
> an automatically created /bin or /output folder). Zipping the file takes
> time, and I have to unzip it each time, which takes more time, this piles
> up when done every few minutes, all day long. I could use raco exe, but I'd
> rather stay in DrRacket, and I'm sure many people would rather have the
> default behavior to not zip, just to have single responsibility on the
> compile function.

That sounds plausible for many cases. (In some cases, depending on the
platform and the program, there are unavoidably multiple output files.)

> One last questions: I have encountered differences in the behavior of
> macros between the REPL, a launcher and a standalone executable for
> distribution. Is there a document outlining the deeper differences between
> these three ways of executing Racket code?

I think you're probably encountering differences in how the namespace
and module registry is set up for `eval` and/or `dynamic-require`.

Maybe you've already seen these, but if not, they're good starting
points:

https://docs.racket-lang.org/guide/reflection.html

https://docs.racket-lang.org/raco/exe.html
(especially paragraphs 3 through 6 about modules)


Gustavo Massaccesi

unread,
May 5, 2020, 11:36:19 AM5/5/20
to Dexter Lagan, Robby Findler, Matthew Flatt, Racket Users
I try to encourage people to participate, but be careful because this task is probably too big for a first contribution. GUI is difficult, DrRacket has a lot of moving parts, and opening DrRacket inside DrRacket is possible but weird.

I think the guess of Matthew is correct, it´s a problem with the blue arrow with the docs. There is no pause while you type numbers but when you type a letter or +-*/... there is a pause of 1 or 2 seconds.

I didn't see the code but my guess is that the docs are loaded lazily in a thread and when DrRackets see something like an identifier it waits until the thread is ready. It would be nice if the blue arrow is disabled until the docs are completely loaded lazily. I think Robby can tell if I'm correct and how hard is to fix this.

Gustavo


--
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...@googlegroups.com.

Robby Findler

unread,
May 5, 2020, 12:17:54 PM5/5/20
to Gustavo Massaccesi, Dexter Lagan, Matthew Flatt, Racket Users
On Tue, May 5, 2020 at 10:36 AM Gustavo Massaccesi <gus...@oma.org.ar> wrote:
I try to encourage people to participate, but be careful because this task is probably too big for a first contribution. GUI is difficult, DrRacket has a lot of moving parts, and opening DrRacket inside DrRacket is possible but weird.


+1
 
I think the guess of Matthew is correct, it´s a problem with the blue arrow with the docs. There is no pause while you type numbers but when you type a letter or +-*/... there is a pause of 1 or 2 seconds.

I didn't see the code but my guess is that the docs are loaded lazily in a thread and when DrRackets see something like an identifier it waits until the thread is ready. It would be nice if the blue arrow is disabled until the docs are completely loaded lazily. I think Robby can tell if I'm correct and how hard is to fix this.


Definitely sounds like an extremely actionable hypothesis to investigate and, if it turns out to be correct, I guess it should be a simple matter of programming to do what you're suggesting.

Robby

Dexter Lagan

unread,
May 6, 2020, 5:50:42 AM5/6/20
to Robby Findler, Gustavo Massaccesi, Matthew Flatt, Racket Users
  Couple years ago I developed an IDE for NewLISP called NewIDE using a commercial tool called Xojo. It was supposed to become NewLISP's official IDE. I had to put the project on pause because of work and family, and at the same time I switched to Racket, hence my interest. It had replicated most of DrRacket's basic functions apart from the debugger and profiler, but was much faster (native controls + LLVM). I have plenty of time on my hands lately, and I'll take a couple hours each day to analyze DrRacket and see where I can reduce delays and improve responsiveness. Who knows, it might pay off.

After a quick first pass over each module, what DrRacket's source needs is :
1) a detailed description of what each module does;
2) a description of what each function/class does, methods and properties etc. I don't see a lot of comments at the moment.

  I'll gladly volunteer to write those. I'll annotate the code as I go through it, and I'll push it to a new github when I have enough of it documented. If the DrRacket's authors are happy with the result, we'll merge?

  As for the delay, I'm sure there's a callback somewhere which launches the context-sensitive help, or loads the docs in the background like you said. There's gotta be a way to move this loading time somewhere more appropriate, like say during the init splash, or at the very least display a loading dialog box to inform the user.

Let me know what you think,

Dex

Dexter Lagan

unread,
May 6, 2020, 6:31:09 AM5/6/20
to Robby Findler, Gustavo Massaccesi, Matthew Flatt, Racket Users
  To add to my previous message, I know and understand that DrRacket and GUI are very complex. I've been going over unit.rkt. Yeah it's a lot of code. But it's not as bad as I thought.
I'm just offering a hand in making sense of it all. With enough time and patience I'm sure I'll get something out of it. Now, if you think my time would be better used for something else Racket-related, do tell.

Dex

On Tue, May 5, 2020 at 6:17 PM Robby Findler <ro...@cs.northwestern.edu> wrote:

Dexter Lagan

unread,
May 6, 2020, 8:25:03 AM5/6/20
to Robby Findler, Gustavo Massaccesi, Matthew Flatt, Racket Users

  If that can help, I narrowed down the delay to new files only, after typing a known symbol only. When opening an existing file, no matter what I type in, no delay. If I start a fresh DrRacket, I can type anything in the definitions window with no delay. The delay only happens if I type a known function name, for example ‘define’. If I type ‘defind’, there’s no delay. The delay also appears in Scheme mode, and with background expansion disabled. No delay in Text mode, which makes sense.

 

  I’m currently looking at the definitions-text from unit.rkt, to see where’s the hook that detects symbols. I have the day off, and I’m enjoying this very much.

 

Cheers,

 

Dex

Gustavo Massaccesi

unread,
May 6, 2020, 9:05:50 AM5/6/20
to Dexter Lagan, Robby Findler, Matthew Flatt, Racket Users
I´m not sure if you are writing your own list of known symbols or if you are reusing a list of known symbols that DrRacket is using for something else.

Gustavo

Dexter Lagan

unread,
May 6, 2020, 9:55:14 AM5/6/20
to Gustavo Massaccesi, Robby Findler, Matthew Flatt, Racket Users
  If you open DrRacket, a new tab opens with #lang racket.
I can type anything I want, a lot of random characters, numbers etc. As soon as any keyword is recognized, there’s the pause. For example:

Hejheke
Idhnehje
Osjdjvehjekd
Hdiisbsidhjd
Gueojd jdbdbskbd jdjdb defino definii define <- pause here

  It does the same on any of my systems.

Dex

On May 6, 2020, at 3:05 PM, Gustavo Massaccesi <gus...@oma.org.ar> wrote:



Yuki Lee

unread,
Jun 21, 2020, 4:04:43 AM6/21/20
to Racket Users
If you wrote a note or blog while reading the code, please share it with me, thank you.

在 2020年5月6日星期三 UTC+8下午5:50:42,Dexter Lagan写道:
Reply all
Reply to author
Forward
0 new messages