freenode/lisp - IRC Chatlog
Search
7:22:38
shrdlu68
The design of x509 is frustrating. It requires parsing a data structure multiple times. Parse it once, extract x and y, then go back again and extract a and b.
7:24:52
flip214
shrdlu68: uh... why not simply get all attributes out (recursively?) first time around?
7:28:56
shrdlu68
flip214: That's what I'm doing, except "all the attributes" keeps changing as you read the specs.
7:31:09
shrdlu68
I'm discovering now that for OSCP checking, I need the hash of the DER-encoded value of the public-key-info in a certificate, and the distinguished name.
7:32:16
shrdlu68
Which means either re-encode what I have decoded, which is insane, or go back and save the raw data before decoding _and_ then decode it and save the attributes in it too.
7:34:59
shrdlu68
The ASN.1 parse includes a :mode option, either :serialized or :deserialized. If you use :deserialized (the default), it recursively deserializes an ASN sequence for you and returnt the elements: strings, integers, octet strings, object identifiers, etc.
7:36:25
shrdlu68
Which saves a lot of work because if you use :serialized then you have to deserialized each element manaully, which is soul-corroding because a sequence may contain a very large number of nested elements.
7:36:54
flip214
shrdlu68: I'd recommend to just store displaced arrays into the original data along with the parsed-out data somewhere.
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.