freenode/lisp - IRC Chatlog
Search
22:22:31
Feldman
So I was looking at Robert Strandh's paper and I wanted to implpment it as my university project. I was told on the discord that you had partial done some of it and that I should contact you.
22:26:23
scymtym
i see. by now, there are multiple implementations that are to some extent based on that technique. what i did is actually pretty far from what the paper describes. part of the reason is that i targeted SBCL
22:26:45
scymtym
i talked a bit about my implementation here: https://techfak.de/~jmoringe/dispatch-demo.ogv
22:28:42
scymtym
as far as i know, SICL (by Robert Standh) has one, ECL has most of the required infrastructure and Clasp more or less implements what is described in the paper
22:30:04
Feldman
Do you think it would still be worthwhile writing my own implementation in the SBCL code?
22:34:08
scymtym
that is worthwhile in my opinion, but i'm not sure it would make a good university project. since SBCL organizes standard instances and also other objects very differently compared to the assumptions of the paper, you would have to bridge over many gaps
22:34:32
scymtym
while that makes the project more interesting and researchy, it is also hard and requires time
22:35:33
Feldman
Officially the project is 300 hours of work, but in practice it ends up being more than that.
22:35:42
scymtym
SBCL has immediate objects with lowtags, instances with a layout, a classoid and a class, "other pointers" with a widetag
22:37:02
scymtym
i think making something that could actually replace the dispatch part of PCL in SBCL is much more work. you could aim for a proof-of-concept, of course
22:38:06
scymtym
you know what, i mentioned that ECL now has some of the infrastructure required for fastgf which was in fact added in order to eventually implement it. maybe as jackdaniel about adding fastgf to ECL instead
22:45:52
Feldman
sorry what do you mean implemented "the thing"? what thing? (infrastructre on ECL, worked on fastgf on Clasp etc)
22:47:28
Bike
i mean, drmeister did it first, but i've pretty much rewritten it all a few times by now, so i'm familiar with the workings
22:50:44
Feldman
My worry with ECL is that if all the "infrastructre" is there, it might not be enough to count, but SBCL does seem much harder yeah.
22:53:11
scymtym
jackdaniel is one of the maintainers of ECL. he should have a good idea of what would need to be done for ECL. he is available in this channel during European daytime most of the time
22:54:04
Feldman
Scymtym, what exactly did you mean by "infrastructure" now that I think of it? I'll make sure to contact jackdaniel as well ofc
22:55:02
scymtym
i don't know any details but i think jackdaniel changed or extended the object representation in ECL to add stamps
1:44:14
npfaro
i have a problem with slime/emacs. When i put the cursor inside a form where the auto-complete would kick in, it puts the Common Lisp one provided from slime in the minibuffer, but then about half a second later it's overwritten by the ELisp one
1:47:21
ludston
npfaro: Are you using the lastest version of Emacs/slime/your lisp implementation? What auto-complete package are you using in emacs?
1:48:40
npfaro
ludston: not really auto-complete but rather the little function signature that appears in the minibuffer. I think it's called eldoc? I just disabled eldoc-mode in the lisp buffer though and it's still doing it so idk
1:55:51
ludston
Probably something in your .emacs file is hooking elisp to the same auto-complete lib? I assume you are coding in both elisp and CL?
2:00:43
ludston
To me it smells like there is some hook in your .emacs file like (add-to-list 'some-elmacs-buffer-hook 'some-elisp-fn-lookup)
2:01:30
Bike
it looks like i have both eldoc and global-eldoc minor modes on but loop displays correctly
2:04:03
npfaro
alright. as far as i can tell, there's nothing touching elisp or slime in my config file
2:11:49
Nilby
I ran into problems like this. But I'm not sure I solved them. I just turned off slime-autodoc.
2:12:07
Nilby
But I have some code like this https://plaster.tymoon.eu/view/2248#2248 in my start up.
2:23:58
charles`
If I want to change directory, load file, then change back, why doesn't this work. It doesn't seem to change directory properly?
2:28:32
Nilby
I'm sorry to say it's complicated and slightly implementation dependent. On some implementations you can just chdir, on some you have to set *default-pathname-defaults*, on some maybe both?
2:48:00
Nilby
Oh, I forgot shcl is the other shell. I use the asdf path for loading, but I guess "cd" and load still works.
3:13:37
npfaro
I'm reading a multi-megabyte file into an array and I think slime is crashing every time it tries to print it
3:40:34
pillton
ACTION has had to wait for the REPL to print out a high-definition image a few times.
3:48:46
npfaro
I have an array of values such that there are groups of 4. so I want to loop over them in groups
3:49:11
npfaro
Say I have #(1 2 3 4 5 6 7 8) I'd like to loop over them so that I can treat them as '((1 2 3 4) (5 6 7 8))
3:49:11
Bike
you mean like you have #(0 1 2 3 4 5 6 7 ...) and you want to work with 0 1 2 3 first, then 4 5 6 7, etc?
3:50:36
Bike
i don't think there's a way to do it with the vector directly. you could cook up something with indices like that.
3:53:17
Bike
i would also do it with the indices. if you want nicer syntax, you could probably design your own clause if you used ITERATE instead of loop
3:53:40
Nilby
or something like (loop with a = #(1 2 3 4 5 6 7 8) for i from 0 below (length a) by 4 do (format t "~s~%" (subseq a i (+ i 4))))
3:57:28
edgar-rft
I think displaced arrays are meant to be used for sub-arrays of big arrays but I need to fiddle out the syntax.
4:03:09
Bike
for large sections the displaced array probably uses less memory than subseq and involves less copying time
4:07:49
Bike
if the chunks are pretty short, i would guess that the copying overhead doesn't matter, and instead you hit slowness because you're using aref on a non simple array
4:07:59
ludston
What is a good word for destructuring a collection into chunks of n length? If it was pairs, you would say "zipping and unzipping"?
4:08:15
Bike
sbcl is probably smart enough to realize that if you're doing aref on subseq it's a simple aref
4:08:44
aeth
However, what I personally do in this situation is use the array macros/functions/etc. that I wrote. https://gitlab.com/zombie-raptor/zr-utils/-/blob/adfe5751a2b327569efb55e0d1c89c7aea9c61f7/array.lisp
4:09:12
aeth
I can decompose an array of length 4 into multiple values, to avoid additional consing (in most circumstances)
4:11:13
aeth
This can compose well with most things, but LOOP doesn't afaik have a way to bind multiple values at once (without a SETF in the body, of course) so it might not be the best kind of iteration for that.
4:12:18
aeth
I just recently extended my function to support offsets, so it can solve this problem in particular, e.g. (zr-utils:array-of-4 (vector 1 2 3 4 5 6 7 8) 4) => 5 6 7 8
4:13:34
Bike
a really fancy compiler could probably elide actually consing a displaced array for certain uses. i don't think any implementation actually bothers, though.
4:14:46
aeth
The problem is that "displaced arrays are slow" is common knowledge, so it's not idiomatic to use it, and non-idiomatic things aren't optimized because it's not worth the time.
4:17:00
Bike
at least the kind of immediate cursor i'm imagining being optimizable could just be done pretty straightforwardly with indices
4:17:43
Bike
passing them between functions could be nicer, but then interfunctional optimization is harder
4:18:56
aeth
For 2-4 values, I love the compositional possibilities with the multiple-values route, although the syntax is pretty awkward. At the function boundary, you're basically forced to multiple-value-call. And it's not going to help you if you're calling a non-inline function that uses double-floats (or similarly boxed things).
4:19:47
aeth
Obviously if it's closer to, say, 20+ or especially 200+, then something like displaced arrays would be way better.
4:20:40
Nilby
If displaced arrays are optimized away inside a function, then they're probably fine as just a struct for passing indices around.
4:20:41
pillton
beach: I had a read of your call-site optimization paper. I like it. I think the information about the callers would be useful for editors or reflection. I also think you could perhaps mention if it is possible to compile the callee more than once to suit the type information provided by the caller.
4:22:09
pillton
beach: I wonder if the word "type" in the last sentence of the second paragraph of page 2 should be "class"?
4:22:32
aeth
Nilby: The problem is, most of the heavy optimizations are going to be inside of a function, or at least inside of a file, and the time when you'd really, really want to used displaced arrays is to treat a random subarray as an array when calling a general purpose function that expects the latter
4:24:27
aeth
I suppose it could still help if those functions were inline, which could be a surprising amount of vector math stuff, especially if they were designed for this.
4:28:58
pillton
aeth: I'd rather compilers focus on eliminating indice checks for vector math stuff.
4:29:48
charles`
is there a way to read a file that has lisp code and get what the result is? if a file contains (+ 1 2), (return-load "file") => 3
4:32:42
beach
pillton: I don't think it would be necessary to compile the callee more than once. It would typically have the structure so that a prefix would test the types, and part of that prefix can then be skipped so that the snippet jumps to the middle of the callee.
4:34:19
pillton
beach: For most cases yes, but there are unique cases where it is important e.g. https://github.com/markcox80/template-function/wiki/Motivating-the-Template-Function-System
4:41:16
pillton
beach: I can't at the moment as I have to go soon. I am in no hurry for you to read the link. I think it highlights the issue I am talking about better than I could explain it here.
4:45:05
Nilby
charles`: maybe (eval (read-from-string (alexandria:read-file-into-string "foo.lisp")))
5:05:05
beach
pillton: I am not in favor of recompiling the callee according to the information provided by the current callers, but I can very well see compiling several versions of the callee according to the type information that ANY caller could provide to make the callee faster.
5:10:52
pillton
beach: Sure. That system I linked to provides a mechanism for users to request a specific specialization of an operator. I found this to be easier than trying to implement systems which handle all of the subtypes of REAL and the corresponding array subtypes for every CL implementation.
5:36:06
charles`
Nilby: doesn't work because eval uses some other environment. I tried putting *package* and *readtable* inside, but doesn't work still
5:42:18
Nilby
Hmmm. Maybe you could wrap it with (let ((*package* (find-package :whatever)) (*readtable* (copy-readtable))) (eval (uiop:read-file-form "foo")))