freenode/lisp - IRC Chatlog
Search
10:56:15
xificurC
starting a script with quicklisp enabled takes me 0.3 seconds (sbcl). If I skipped quicklisp and went straight with asdf to load the libraries would I get a speedup? I tried putting `(require "asdf") (asdf:load-system "cl-ppcre")` to test the speed but asdf cannot find cl-ppcre
10:57:07
phoe
xificurC: you could explicitly tell ASDF to look in the proper folder, ~/quicklisp/dists/quicklisp/software/cl-ppcre......
11:00:31
xificurC
phoe: ok, that seems to not crash, however I'm not sure if I'm running the script properly
11:01:49
guaqua
xificurC: what is the reason for optimizing startup speed? if you want to get straight to running your program quickly, i'd suggest you look at saving a core and starting the program with that
11:02:37
xificurC
guaqua: that's a viable solution for 1 script. Imagine all your bash and python scripts were like that
11:03:06
guaqua
that's true. if your scripts seem to share the same set of libraries, they could maybe use the same core
11:03:23
xificurC
I'm optimizing for startup speed because I'm writing a script that can be called many, many times
11:03:46
flip214
and even the monthly updates are just a "rm -rf ~/.cache/common-lisp && ./script" ...
11:04:45
xificurC
so I can create 1 core with all the libs I want to use and then I can write scripts that use that core. Is that correct?
11:04:45
flip214
having a superset of systems loaded doesn't really hurt. My image (including hunchentoot, which requires ~30 other systems(?), and some more) has a 0.03sec "empty" start time.
11:04:54
White_Flame
xificurC: it sounds like you're predicting a launch performance problem, and not actually observed that it's a problem yet?
11:05:20
xificurC
I can preload the libraries so I can already call e.g. cl-ppcre:split without doing any asdf:load-system or ql:quickload?
11:06:27
xificurC
White_Flame: not really. I am planning to write a script that I know will be called dozens of times. If a quicklisp startup takes 0.3 seconds here, that's a no-go
11:06:29
_death
you'd also want a shell script `my-sbcl' or something that uses that core.. then you can do #!/path/to/my-sbcl --script or something
11:07:10
White_Flame
xificurC: stepping back, it seems like you should find a way to batch your requests into a longer running lisp image, than trying to start & stop it so many times
11:12:23
White_Flame
xificurC: given that you're looking to work hard on optimization tests & multiple coding efforts, it might be worth it to put that effort into reducing the number of calls instead
11:17:20
_death
still, there were some issues the last time I used it: https://github.com/death/FFmpeg/commit/91149048ecc8168475889a1a72f97febc13bc88a
12:37:19
xificurC
White_Flame: I understand your point, unfortunately not all programs/scripts fall into that category. You wouldn't e.g. go put all of your database data into 1 big flat table just to be able to get all the necessary data in 1 query, would you
12:37:46
White_Flame
when speed is necessary, database queries tend to be glommed together into 1 mega-query, yes
15:57:06
phoe
so I'm limited to #. but nonetheless the stack-printing debugger hook gives me all the info I think I need
16:45:06
Petit_Dejeuner
Is there a way to use peek-char on a binary stream or an equivalent for binary streams?
16:47:32
Petit_Dejeuner
Thanks. That's kind of lame. I guess I could rewrite this to only use read-byte.
16:50:25
Petit_Dejeuner
Xach: Replace all instances of peek-char with it. I'm writing (yet another) bencode library and I use peek to help me decide what the next item is.
16:52:43
Petit_Dejeuner
jackdaniel: "bencode?" https://wiki.theory.org/BitTorrentSpecification#Bencoding
16:53:03
Petit_Dejeuner
a binary format that supports similar structure to json, it's most popular use is for torrent files
17:37:52
flip214
phoe: you could also have a CONCATENATED-STREAM that consists of a #\(, the file, and #\) ...
17:38:51
beach
phoe: (with-input-from-string (stream (read-line)) (loop with eof = (list nil) for expression = (read stream nil eof) until (eq expression eof) collect expression))
18:02:26
didi
phoe: Because I am defining a new type when I wanted to use EQL to compare objects of this type.
18:04:20
phoe
didi: best define your own predicate, foo= that accepts two objects of type foo and does its comparison login.
18:06:18
phoe
If two objects can be equal despite not having the same identity, then you need to define your own predicate and therefore teach Lisp how it should think about such equality.
18:07:18
phoe
And as for the general case of equality, there were a few articles about equality in Lisp circling around.
18:13:24
didi
phoe: Thanks. I think I will create my own predicate. SBCL's manual says "Thread type. Do not rely on threads being structs as it may change in future versions.", which scares me a little.
18:16:54
didi
Because I will create and manipulate many of them and I want to check if I am on a cyclic dependency.
18:22:03
White_Flame
for struct instances, equal is the same as eq. It's only equalp that walks structure slots
18:35:47
rpg
Anyone an expert with CL-DOT? I'm trying to ensure that a tree graph generated that way renders its children left to right in the order they appear in the points-to methods. But at least sometimes, they are coming out backward.
19:24:52
aeth
How do I use a subrange of a CFFI array? Do I just use a pointer to (* type-size offset)?
19:27:43
axion
Is there an easy way to get rid of the #<> characters when printing an object with PRINT-UNREADABLE-OBJECT?
19:28:02
aeth
Would doing this create garbage? e.g. if I did (cffi:make-pointer (+ (cffi:pointer-address original-pointer) (* type-size offset)))
19:28:36
aeth
This is for the GL matrices in my draw function. I cannot create garbage in my draw function.
19:31:43
aeth
I can just iterate on pointer objects that I've already created if that's the way to do it. Does anyone else have to do something like this?
19:38:38
axion
I must use the pprint-dispatch table instead of PRINT-OBJECT because these are not classes, but instead structs compiled to a :type.
19:41:40
malice
axion:anyway, quoting the clhs: " Outputs a printed representation of object on stream, beginning with ``#<'' and ending with ``>''. "
19:41:54
malice
that's how print-unreadable-object is designed. You are probably looking for something else.
19:51:04
Bike
you can print the class-name or whatever like print-unreadable-object does yourself, if you want
19:59:50
axion
Another question. Is it legal to have a compound function name like (setf func) in the function-names position of (declaim (ftype (function ..))), or must it be a symbol to be portable?