
Hey I am new here, I was wondering if anyone could help me out. I have a very simple GUI app which plots the temperature from sensors exposed through /sys
https://gist.github.com/robinedwards/e9b51f04ca4efca541266a6a3bd81fea Compiling this using raco exe
and running it uses 494MB RES on 7.6 CS and about 300MB RES on 7.4 BC . This seems like an lot for a simple gui app is there some way of improving this?

@robin.ge most likely, you would need to require
fewer things. Are you depending on a lot of libraries?

Just:
#lang racket/base
(require plot)
(require racket/gui)

almost certainly the issue is plot

> (current-memory-use)
58072856
> (require plot)
> (current-memory-use)
128852564

which probably means there’s not much you can do

I know plot makes things easy but if you only need a simple graph maybe just use racket/draw

cool app, btw. Also, you might want to set an initial width and height for the frame — otherwise I wasn’t able to see the window

Ah it maybe because i have a tiling window manager that it worked by accident for me

I put a print out of (current-memory-use)
in the update handler, and I got results like this: 149129872
158044968
159378736
152955160
153565336
145944472
146641016
147399968
148211808
140501456
165773184
158280312

htop
tells me about 228MB RES

that’s with Racket BC

Ah yea it was better on BC cool, I really like plot

i will suck up the memory usage rams cheap any how :slightly_smiling_face:

for current-memory-use, I saw numbers not that much larger than that for just (require plot)
, so you are unlikely to do much better

plot is kinda heavyweight

I guess because of the dynamic nature of the language its hard for the compiler to know which parts of plot to include in the binary

@robin.ge yes, that’s definitely true — it’s including the whole thing both in the binary and loading it at runtime

Hmm just noticed i don’t seem to get ‘full’ syntax highlighting until i hit the ‘check syntax’ button in DrRacket then when i make a change i need to ‘check syntax’ again. Is there some setting I am missing? (Seems to occur in 7.4 and 7.6)

That’s the standard behavior

so i have a list of numbers (list 1 2 3) and i want to turn it into a string , “123” . (list->string) only takes in chars, so is there a way to convert a number into a char? because (integer->char) returns the ascii mapping.. which is not what i want


what you’re doing there is turning a list of characters into a string. #\1
is the character 1
. if you’re starting with an actual list of numbers you could use (string-join (map number->string lst) "")
, where lst
is your list

i used (apply string-append (list ))

also

is the guy who maintains the arch linux repo of racket here?

if so https://www.archlinux.org/packages/community/x86_64/racket/ , please update it… its been a month since 7.6

It seems to me that Racket has a large initial overhead, meaning that small applications still use a lot of memory, but this memory usage does not grow much as the application grows in complexity.
For example, my application has about 40k lines of code, has lots of plots with data sets of 3000+ data points and it still uses only 470Mb using Racket 7.5 BC.

is there a way i can get the binary representation of numbers?

@yanyingwang1 has joined the channel

unsure how to paramaterize a number over #b

ohhh nevermind, its a string

nevermind… (~r num :base 2)

Also (apply ~a '(1 2 3))