elyandarin
2019-12-12 11:02:51

Had kind of a weird error, which I eventually pared down to: #lang racket (require parser-tools/lex-sre) (/ 4 2) unsaved editor:3:0: /: illegal use of syntax in: (/ 4 2) value at phase 1: #<lex-trans> #(45 7)

So apparently, parser-tools/lex-sre is incompatible with… math?


ryanc
2019-12-12 11:10:52

That module shadows a lot of names from Racket, including /. It’s common to require it with a prefix to avoid that problem. There’s a note about it on this page: https://docs.racket-lang.org/parser-tools/Lexers.html (search for “must be imported using a prefix”).


laurent.orseau
2019-12-12 11:58:26

I have a deterministic program with no IO. It does a lot a list processing. When running it multiple times, I observe that the running times vary between 4.5s and 9s, with roughly 10% GC. What factors could account for such a difference?


laurent.orseau
2019-12-12 11:59:09

I’m trying hard to make it fast and memory efficient, so that difference matters a lot to me


sorawee
2019-12-12 12:06:26

Can you share your program?


laurent.orseau
2019-12-12 12:09:59

unfortunately not (plus it’s a pile of 2000sloc, undocumented)


laurent.orseau
2019-12-12 12:19:15

It’s compiled and run from the command line btw.


popa.bogdanp
2019-12-12 12:44:25

Is it currently possible to hide a frame% and give focus to another window (not belonging to the Racket process)? I’m thinking of behavior similar to how Alfred and Spotlight work on macOS: you hit a key (eg. ESC ), the frame disappears and focus is restored to the window behind the one that disappeared.


popa.bogdanp
2019-12-12 12:47:51

Wait… that does seem to work fine if I run my app from the command line. I guess racket-mode must be doing something odd here. nvm!


mflatt
2019-12-12 13:24:32

Any hashing? Do Racket and Racket CS behave the same?


laurent.orseau
2019-12-12 13:36:37

Zero (explicit) hashing. A lot of pairs though. I haven’t tried racket CS yet


mflatt
2019-12-12 13:39:41

Is 4.5s/9s CPU time or wall-clock time?


mflatt
2019-12-12 13:42:04

I guess I don’t have any ideas, yet, except to try Racket CS. If it’s lots of pairs, Racket CS should be both faster and more memory efficient, so maybe whether it is will tell us something.


laurent.orseau
2019-12-12 13:42:58

it is both cpu and wall clock time


laurent.orseau
2019-12-12 13:43:23

measured using both time on the command line and (time ...) in racket


laurent.orseau
2019-12-12 13:43:53

I’ll try racket CS


soegaard2
2019-12-12 13:43:54

To elaborate on what Ryan says. Use (require (prefix-in : parser/lex-sre) This will prepend a colon to all the names. That is, you now need to write :/ instead of just / . :* instead of just * etc.


soegaard2
2019-12-12 13:45:06

If you lookup position-token, you will see it is a struct. One of the fields are named token, so to get the token stored in a position-token, you need to use position-token-token.


samth
2019-12-12 13:45:26

That’s quite surprising. Have you looked at a profile?


laurent.orseau
2019-12-12 13:46:59

The statistical profiler gives no meaningful information anymore. I can give you a dump-memory-stats at high usage if you want.


samth
2019-12-12 13:48:54

Can you try the statistical profiler with errortrace on?


laurent.orseau
2019-12-12 13:49:13

ah maybe I forgot that :confused: Will do!


samth
2019-12-12 13:49:47

Well that isn’t the normal thing to do, and it will make the program slower, but maybe give better info


laurent.orseau
2019-12-12 13:56:57

The profile (redacted) with --use-errortrace is not meaningful either as far as I can tell. The lines referred to are the main functions, so nothing of interest.


samth
2019-12-12 13:57:23

You would need to recompile the program with errortrace enabled


laurent.orseau
2019-12-12 14:14:29

(after re-reading the docs and trying a few things) I’m missing something. Isn’t it: 1. throw away .zo files 2. raco profile --use-errortrace myprog.rkt ?


samth
2019-12-12 14:16:35

I think that should work


laurent.orseau
2019-12-12 14:18:06

ok. then it gives the same result as above. I’ll try racket CS


capfredf
2019-12-12 14:18:33

samth
2019-12-12 14:18:45

You could also try increasing the sampling rate


laurent.orseau
2019-12-12 14:19:26

good idea


laurent.orseau
2019-12-12 14:21:03

Wow, on Racket CS it runs in 2.4s with little variance!


samth
2019-12-12 14:21:32

Yay, but still surprising for traditional Racket


laurent.orseau
2019-12-12 14:22:00

indeed


laurent.orseau
2019-12-12 14:22:15

I’ll still try with higher sampling freq


mflatt
2019-12-12 14:25:18

@laurent.orseau Another thought, especially given the Racket CS result: does your program involve any deep (non-tail) recursion?


laurent.orseau
2019-12-12 14:26:23

@samth The reason the profiler wasn’t giving anything is because I’m using with-limits which I guess implicitly runs a thread. Using the --all-threads options works


samth
2019-12-12 14:26:53

Aha


laurent.orseau
2019-12-12 14:27:18

@mflatt There is possibly a fair amount of non-tail recursion, but it shouldn’t be very deep (say a dozen levels)


laurent.orseau
2019-12-12 14:36:13

That’s a pretty good incentive to start using Racket CS :slightly_smiling_face: Thank you both for your help!


mflatt
2019-12-12 14:42:01

Obviously, let us know if just using Racket CS doesn’t work out. But Racket CS really should be a viable option at this point, especially if you can use snapshots. It’s worrying that we don’t know what went wrong in traditional Racket, but there are all sorts of areas where Racket CS provides more consistent performance than traditional Racket.


laurent.orseau
2019-12-12 14:48:02

Aha, I think I found the culprit! I think I had forgotten to compile a dependency that basically exports a single macro (which is used at a sensitive place)


laurent.orseau
2019-12-12 14:48:15

Now the times are about 4.1s to 4.3s for traditional Racket


laurent.orseau
2019-12-12 14:56:34

Sorry for all the noise then, but that’s been very helpful anyhow


laurent.orseau
2019-12-12 15:11:13

Wait, isn’t raco make supposed to compile the dependencies too?


samth
2019-12-12 15:11:23

yes, definitely


laurent.orseau
2019-12-12 15:12:35

uh, then I don’t understand. The high variance results were after raco make myprog.rkt and the faster, low variance ones where after raco make myprog.rkt the-dep.rkt


samth
2019-12-12 15:13:13

that suggests a problem with raco make and the relationship between myprog and the-dep.


samth
2019-12-12 15:13:20

is it just a regular require?


laurent.orseau
2019-12-12 15:14:14

yes


samth
2019-12-12 15:14:27

that’s very odd then


laurent.orseau
2019-12-12 15:19:09

Maybe I’m interpreting too much and I’m overlooking something I did that would explain it


samth
2019-12-12 15:19:34

maybe you removed a zo file at some point, or edited the-dep


laurent.orseau
2019-12-12 15:37:15

Hmm, I’m seeing some variance again, this time also with Racket CS (still faster though). I’m starting to suspect that my machine just has ups and downs


laurent.orseau
2019-12-12 15:38:59

This time I’m sure I’m compiling everything. I’m running the same program twice in a row, once it takes 4.3s, the next one it takes 8.8s…


elyandarin
2019-12-12 16:01:00

Hm, so far there’s only the one ’/’ I need - could I specify the namespace or re-bind ’/’ to ‘divide’ before the require comes into effect or something?


laurent.orseau
2019-12-12 16:20:15

@samth was there something you were looking for in the profile that could give a hint about the variance?


samth
2019-12-12 16:20:31

just what it spent a lot of time doing


laurent.orseau
2019-12-12 16:20:44

ok


mflatt
2019-12-12 17:38:25

DrRacket users who suffer slow/unresponsive scrolling: Does the current snapshot at https://www.cs.utah.edu/plt/snapshots/ behave any better?


ruyvalle
2019-12-12 17:56:11

Yes. It’s still a little unresponsive but better. Also with DrRacket 7.5 I can scroll at most about 100 lines in a single motion whereas with the current snapshot there is no practical limit. I’m on macOS high sierra by the way.


sorawee
2019-12-12 18:30:06

What’s changed? I looked at https://github.com/racket/drracket/commits/master and saw nothing.


laurent.orseau
2019-12-12 18:30:46

It’s a placebo test :stuck_out_tongue:


laurent.orseau
2019-12-12 18:35:25

my guess would be to look at racket/gui instead maybe


mflatt
2019-12-12 18:39:46

While it’s not a placebo test, I did intentionally refrain from explaining the change to avoid biasing the way you might test scrolling.


elyandarin
2019-12-12 19:56:41

Hm, how would I easiest test whether a single pattern in my lexer works? Is there a function where I can plug in that pattern and a target string and see the result?


notjack
2019-12-12 20:03:04

Oh this makes me excited, I’m gonna try out the snapshot as soon as I can after work



elyandarin
2019-12-12 20:13:48

thanks, I’ll check it out!


elyandarin
2019-12-12 20:54:57

Hm, not quite what I’m looking for. I tried to make a testing function here: (define (investigate pattern string) (define-lex-abbrev x pattern) (define lex (lexer [(x) (token 'test lexeme)] )) (lex/src (open-input-string string)) ) Any advice about what I’m doing wrong?


samdphillips
2019-12-12 21:02:12

define-lex-abbrev is a macro that needs a literal pattern, not a variable with a pattern in it.


ben
2019-12-12 21:02:29

we’re having trouble verifying the changes with raco pkg install and with step 5


samdphillips
2019-12-12 21:02:59

Also IIRC most of the patterns in the parser-tools are not runtime values. They get compiled into the lexer.


ben
2019-12-12 21:05:59

step5 gives errors that typed-racket & other packages can’t be found


alexknauth
2019-12-12 21:08:25

Some examples of errors I’m getting during step 5 include: raco setup: error: during making for <pkgs>/errortrace-lib/errortrace raco setup: open-input-file: cannot open module file raco setup: module path: syntax/source-syntax raco setup: path: /home/racket/racket/racket/collects/syntax/source-syntax.rkt raco setup: system error: no such file or directory; rktio_err=3 raco setup: compiling: <pkgs>/errortrace-lib/errortrace/stacktrace.rkt and: raco setup: error: during making for <pkgs>/source-syntax/typed-racket-test/performance raco setup: standard-module-name-resolver: collection not found raco setup: for module path: typed/racket/base raco setup: collection: "typed/racket" raco setup: in collection directories: raco setup: /home/racket/racket/build/user/7.5.0.11/collects raco setup: /home/racket/racket/racket/collects raco setup: ... [29 additional linked and package directories] raco setup: compiling: <pkgs>/source-syntax/typed-racket-test/performance/function-contract.rkt


marco.dallagiacoma
2019-12-12 21:18:36

@marco.dallagiacoma has joined the channel


ben
2019-12-12 21:36:44

okay maybe those step5 issues were our mistake … the urls we put in the catalog were wrong (we had https://.....#commit?path=.... instead of https://....?path=....#commit )


ben
2019-12-12 21:44:37

sigh, maybe both fails were because of that


ben
2019-12-12 22:17:59

success on 5 and 6!


ben
2019-12-12 22:18:07

how do we start an http server?


ben
2019-12-12 22:41:06

phew we used python3.7 -m http.server (also tried & failed with plt-web-server)


alexknauth
2019-12-12 23:39:27

I’m at the step where I’m following the pkg-build instructions, and I’m getting this error when running run.rkt: >> Getting installer table hash-ref: no value found for key key: "{1} Racket \| {3} Linux \| {4} x64_64 (64-bit), natipkg; built on Debian 7 (Wheezy)" context...: /home/racket/.racket/snapshot/pkgs/pkg-build/main.rkt:123:0: build-pkgs "/home/racket/racket-pkg-build/run.rkt": [running body] temp35_0 for-loop run-module-instance! perform-require!


capfredf
2019-12-12 23:43:08

I usually use python3 -m http.server <port>


ben
2019-12-12 23:45:11

whats a good port? do we need to tell pkg-build the port?


ben
2019-12-12 23:45:35

the default is 8000 and seems okay; we tried 80 and get permission errors


alexknauth
2019-12-12 23:45:43

The default port seems to be 8000, I’m getting permission errors when trying other things like 80


capfredf
2019-12-12 23:46:12

Yes, 8000 is fine


capfredf
2019-12-12 23:46:43

is there table.rktd under the directory build/site?


alexknauth
2019-12-12 23:47:35

no, but there is table.rktd in the separate directory where I’m running run.rkt


capfredf
2019-12-12 23:48:30

weird, IIRC, after make site-from-installers, there should be a table.rktd under build/site


alexknauth
2019-12-12 23:49:43

The table.rktd in that separate directory where run.rkt is is a hash-table where the first key-value pair is ("{1} Racket \| {1} Windows \| x86 (32-bit)" . "racket-7.5-i386-win32.exe")


ben
2019-12-12 23:52:51

I’m not sure about run.rkt ; I do have build/site/installers/table.rktd with 1 entry, localhost -> racket–7.5……..sh


alexknauth
2019-12-12 23:52:58

What if I change the run.rkt to use "{1} Racket \| {3} Linux \| {3} x64_64 (64-bit), natipkg; built on Debian 8 (Jessie)" in the #:installer-platform-name?

Update: that seems to be an improvement


capfredf
2019-12-12 23:54:42

I’m a little confused. What is run.rkt?


alexknauth
2019-12-12 23:55:05

capfredf
2019-12-12 23:55:11

I see.


capfredf
2019-12-12 23:56:55

@ben if you start a http server with port 8000 in the directory build/site and open “http://localhost:8000/” in your browser, you should be able to see something similar to https://www.cs.utah.edu/plt/snapshots/current/installers/


capfredf
2019-12-12 23:58:47

or under build/site/installers


capfredf
2019-12-12 23:59:23

then run the run.rkt, see if it works this time


capfredf
2019-12-13 00:03:38

Yes. The scrolling is much smoother than it was before on macOS


alexknauth
2019-12-13 00:08:09

It seems to have started working after we changed the string "{1} Racket \| {3} Linux \| {3} x64_64 (64-bit), natipkg; built on Debian 7 (Wheezy)" in run.rkt to use "{1} Racket \| {3} Linux \| {3} x64_64 (64-bit), natipkg; built on Debian 8 (Jessie)" instead


ben
2019-12-13 00:08:27

yes I do see the installers page

minutes ago, we both started a run.rkt and it’s doing things (like Alex says)

I gave it the #:host address for my computer though, instead of localhost:8000 so idk if things are going to break later


ben
2019-12-13 00:08:42

but we’re about to stop working on this for today. Thanks for the help!


capfredf
2019-12-13 00:11:43

Oh, I forgot to mention that for the #:installer-platform-name, you have to use a name listed in your table.rktd . Sorry about that…..


ben
2019-12-13 00:13:10

(well the author of pkg-build forgot too)


capfredf
2019-12-13 00:13:56

#:host "192.168.99.100" for that part, you need to make sure which networking mode you are using for your virtualbox instance


ben
2019-12-13 00:14:09

we should try to improve these readmes, and/or write a post for http://blog.racket-lang.org\|blog.racket-lang.org


capfredf
2019-12-13 00:15:38

Usually, I would use bridge mode and then ssh into the guest os and use ifconfig to get the ip address of the guest os (updated: #:host is the ip address of you vm (https://github.com/racket/pkg-build/blob/master/main.rkt#L328) )


capfredf
2019-12-13 00:15:50

then use that address in run.rkt


capfredf
2019-12-13 00:16:24

:cry:(looks like I forgot to mention more things than I thought)


alexknauth
2019-12-13 01:13:11

So following the steps in pkg-build running run.rkt, It went for a while, including archiving, downloading, packing, and writing checksums for all the packages from a-to-z, but then failed with this error message: Creating catalog /home/racket/racket-pkg-build/server/archive/catalog >> Starting server at locahost:18333 for /home/racket/racket-pkg-build/server/archive >> Starting VM pkg-build Stopping VirtualBox machine "pkg-build" system*: contract violation expected: path-string? given: #f context...: /usr/racket-7.5.0.10/collects/racket/system.rkt:181:19 /usr/racket-7.5.0.10/collects/racket/system.rkt:174:0: do-system*/exit-code /usr/racket-7.5.0.10/collects/racket/system.rkt:211:0: system* /home/racket/.racket/snapshot/pkgs/remote-shell-lib/vbox.rkt:112:0: stop-vbox-vm /usr/racket-7.5.0.10/collects/racket/contract/private/arrow-val-first.rkt:555:3 /home/racket/.racket/snapshot/pkgs/pkg-build/main.rkt:445:2: install /home/racket/.racket/snapshot/pkgs/pkg-build/main.rkt:515:2: check-and-install /home/racket/.racket/snapshot/pkgs/pkg-build/main.rkt:123:0: build-pkgs "/home/racket/racket-pkg-build/run.rkt": [running body] temp35_0 for-loop run-module-instance! perform-require!


alexknauth
2019-12-13 01:26:25

alexknauth
2019-12-13 01:27:18

Where VMoxManage is defined with (define VBoxManage (find-executable-path "VBoxManage")) here: https://github.com/racket/remote-shell/blob/71cb7647c90851fac4629523d34983375fc2caa3/remote-shell-lib/vbox.rkt#L29


ben
2019-12-13 01:28:23

ah ok, the pkg-build instructions did ask for VBoxManage to be on your PATH


ben
2019-12-13 01:28:40

I think that means we don’t want to run run.rkt in the VM


alexknauth
2019-12-13 01:29:01

It is on my path outside the VM, but not inside


ireneista
2019-12-13 01:41:07

@ireneista has joined the channel


capfredf
2019-12-13 02:05:26

Does (find-executable-path "VBoxManage") return #f on the host os? @alexknauth


alexknauth
2019-12-13 02:07:54

Depends on DrRacket vs Command-Line. • DrRacket: yes, it returns #f • Command-Line: no, it returns #<path:/usr/local/bin/VBoxManage> outside the VM


capfredf
2019-12-13 02:09:35

so if you run racket run.rkt at command line outside the VM, are you still getting the error message you posted ?


alexknauth
2019-12-13 02:14:05

I’m in the middle of trying that now


alexknauth
2019-12-13 02:20:19

I accidentally installed the wrong pkg-build package, and then I had a weird extra invisible character to delete, and now I’m running it


alexknauth
2019-12-13 02:21:33

It’s going through archiving, downloading, packing, and writing checksums for all the packages again, I’ll update once it gets past that step to see if this error is fixed now


alexknauth
2019-12-13 05:00:34

Okay, same place, different error this time: Creating catalog /Users/Alex/racket-pkg-build/server/archive/catalog >> Starting server at locahost:18333 for /Users/Alex/racket-pkg-build/server/archive >> Starting VM pkg-build Stopping VirtualBox machine "pkg-build" VBoxManage: error: Could not find a registered machine named 'pkg-build' VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports VBoxManage: error: Context: "FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 382 of file VBoxManageControlVM.cpp VBoxManage: error: Could not find a registered machine named 'pkg-build' VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2621 of file VBoxManageInfo.cpp vbox-state: could not get virtual machine status: "pkg-build" context...: /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/remote-shell-lib/vbox.rkt:112:0: stop-vbox-vm21 /Applications/Racket/2019-10-21/Racket v7.5.0.3/collects/racket/contract/private/arrow-val-first.rkt:555:3 /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/pkg-build/main.rkt:445:2: install64 /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/pkg-build/main.rkt:515:2: check-and-install70 /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/pkg-build/main.rkt:123:0: build-pkgs57 "/Users/Alex/racket-pkg-build/run.rkt": [running body] temp37_0 for-loop run-module-instance!125 perform-require!78


alexknauth
2019-12-13 05:03:16

Looks like the error is (error 'vbox-state "could not get virtual machine status: ~s" vbox) from https://github.com/racket/remote-shell/blob/71cb7647c90851fac4629523d34983375fc2caa3/remote-shell-lib/vbox.rkt#L49


alexknauth
2019-12-13 05:07:10

Which is triggered by the state not being one of the symbols (\|powered off\| aborted running saved paused restoring) from the case expression https://github.com/racket/remote-shell/blob/71cb7647c90851fac4629523d34983375fc2caa3/remote-shell-lib/vbox.rkt#L43-L49


alexknauth
2019-12-13 05:11:18

My probably-wrong-or-incomplete assumption was that the name pkg-build in the error message comes from (vbox-vm #:name "pkg-build" #:host "0.0.0.0:8000"), where the host 0.0.0.0:8000 comes from the IP address and port that the Python web server gave me. So when it says it can’t get the state of that machine, is it saying it can’t get the state from that Python web server?


alexknauth
2019-12-13 05:24:01

I’m trying again with a different #:host field value taken from the result of running hostname -I on the VM


alexknauth
2019-12-13 06:26:50

Well, even with that, same error: Creating catalog /Users/Alex/racket-pkg-build/server/archive/catalog >> Starting server at locahost:18333 for /Users/Alex/racket-pkg-build/server/archive >> Starting VM pkg-build Stopping VirtualBox machine "pkg-build" VBoxManage: error: Could not find a registered machine named 'pkg-build' VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports VBoxManage: error: Context: "FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 382 of file VBoxManageControlVM.cpp VBoxManage: error: Could not find a registered machine named 'pkg-build' VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2621 of file VBoxManageInfo.cpp vbox-state: could not get virtual machine status: "pkg-build" context...: /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/remote-shell-lib/vbox.rkt:112:0: stop-vbox-vm21 /Applications/Racket/2019-10-21/Racket v7.5.0.3/collects/racket/contract/private/arrow-val-first.rkt:555:3 /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/pkg-build/main.rkt:445:2: install64 /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/pkg-build/main.rkt:515:2: check-and-install70 /Users/Alex/Library/Racket/snapshot-7.5.0.3--2019-10-21/pkgs/pkg-build/main.rkt:123:0: build-pkgs57 "/Users/Alex/racket-pkg-build/run.rkt": [running body] temp37_0 for-loop run-module-instance!125 perform-require!78


soegaard2
2019-12-13 07:13:59

Lookup rename-in