libera/#commonlisp - IRC Chatlog
Search
21:44:29
asarch
I have: (defclass foo () ((beer :initform 3))) and then (defclass bar (foo) ()) and I would like to have 6 as the default value of beer in bar. How can I do this?
21:47:05
asarch
Should I (defclass bar (foo) ((beer :initform 6))) or should I (defmethod initialize-instance :after ((instance foo)) (setf (slot-value instance 'beer) 6))?
22:31:45
asarch
How is better (in terms of efficiency)? (setf buffer (concatenate 'string buffer "…")) or just (setf buffer (format nil "~s …" buffer))?
22:34:13
hayley
Many Lisp implementations generate formatter functions at runtime, if the format string is constant.
22:39:17
sm2n
even if you pass a value to make-instance it will be overriden by your method in that case
22:40:50
sm2n
initialize-instance is more for doing things on new objects in general, for example putting them in a pool etc
23:03:21
asarch
You have (let ((food '(beer taco pizza))) …) and then (loop for element in food do …). Is there a way to know what element (n-th) you are currently in every loop?
23:15:06
dre_
if I'm going to be stuck without internet for a while, what's the best way to have a reference to common lisp ?
23:16:05
dre_
I suppose I have PCL and LOL and I could just flick through that to find something I want to do, but if I could have a thing like 'how do I do x' -- offline, while I'm away, that would be helpful
23:21:41
dre_
yeah I was thinking slime might have something worthwhile for me, but I (as a lowly vim user) will keep clutching at my pearls
23:43:31
asarch
How can you make Emacs to "unlearn" a word for word suggestions? E.g. when you type 'indxe' instead of 'index'?
0:32:55
Xach
asarch: it uses a hash table to store them, so i suppose it is limited by available memory.
0:45:29
hayley
Probably a fair few, assuming they use approximately too many languages, which probably is the case.
0:58:08
rotateq
maybe also Clojure (which states it's good for concurrency) or Elixir. the second maybe used in twitch too (I don't know), but surely amazon just bought it in 2014
0:58:54
rotateq
hayley: it's easier to list the few powerful things they and others manage to go around :P
6:01:01
beach
If anyone is ever tempted to improve performance by profiling and low-level optimizations, I recommend you watch this video by Emery Berger "Performance Matters": https://www.youtube.com/watch?v=r-TLSBdHe1A
6:01:02
beach
It should tell you that such attempts are pretty futile and that for low-level optimizations to be worthwhile, you need some way more sophisticated tools than a profiles.
6:03:36
beach
For me as a person creating a Common Lisp implementation, I conclude that it would be a huge waste of time for me to guess what would improve overall performance, implement an improvement, and perhaps see some minor performance improvement.
6:06:16
hayley
.oO(Yes, a video on performance by the man who famously ruined discussing garbage collection by "quantifying" the effects of garbage collection over explicit memory management. The video is actually useful, but I'm still annoyed.)
6:07:24
beach
It happens regularly as I recall, but I may have dreamed that. I seem to remember relative newbies asking whether to do this or that.
6:11:57
beach
hayley: I can see why you are annoyed. But there are often several different possible conclusions of some work. In this one, you may conclude that you should always write C code and use his tools. But my conclusion is that you should be careful with how to attempt to optimize the performance of your code.
6:14:07
beach
I frequently cite the paper by Hudak and Jones, too. You may conclude from that paper that you should always use Haskell, but I conclude that choosing the right programming language for a particular task can make a factor 20 difference in development time.
6:15:52
hayley
But, much like how people point to benchmarks like the language shootout to make a point, without actually reading the benchmarks (e.g. anything to do with regular expressions usually involves FFI to PCRE2), the paper by Berger and Hertz I am thinking of is "read" in a way that allows one to present shocking results about the performance of garbage collection.
6:17:27
beach
I haven't read the paper, and perhaps I should. Are you saying that this is not what one should conclude from it?
6:17:44
hayley
The more careful reader would note that the baseline for explicit memory management is generated (as they want to test using Java programs) using an undecidable algorithm. So any explicit memory management technique the programmer uses, or any memory management generated by a compiler (using e.g. regions or linear types) is going to be strictly worse performing than the algorithm presented.
6:18:05
beach
It would be surprising since Emery was working in a group that was definitely in favor of automatic memory management.
6:19:36
hayley
The conclusion isn't wrong, and I shouldn't blame any interpretation on the authors. But they do overstate the usefulness of their results, in my opinion, since they did not show how their algorithm is representative of what any programmer does.
6:20:56
beach
I see. Well, that could be the effect of the need for funding and/or publications for the career.
6:23:07
hayley
I don't want to distract anyone from the presentation you mentioned though. I tried to make a causal profiler for Common Lisp, but managed to crash SBCL in a way I didn't understand, so I gave up. Someone else should definitely have another try at it.
6:29:11
hayley
(Though, I recall Steve Blackburn et al published a similar paper about a week ago, comparing real Java collectors to an "ideal collector", as determined by removing time spent in the collector. But this produces a neither-fish-nor-foul result where you get all the benefits of such collectors, like compacting, but none of the drawbacks. Someone already tried to use the results to dismiss other publications as "idiotic bragging".)
6:30:15
hayley
(Again, not the fault of Blackburn or anyone else, but it makes discussing performance harder.)
6:34:39
hayley
I only bring it up since there was an online programming community I would have liked to participate in, but the participants had already fallen for such noise. It made me feel more uncertain about what I'll do in the future than usual.
6:59:29
hayley
It is more that the algorithm uses more information than any static analysis could gather (and also is more accurate than any dynamic feedback scheme, since it knows exactly where an object is no longer reachable). You're right that undecidability is not the most crucial part of the results, but it is necessary and shows that the algorithm can only be an upper bounds on performance.
6:59:45
Lycurgus
a judicious expediture of effort would be enabling cheney (in sbcl) and also sbcl is a problematic implementation in general compared to others that are less so
7:00:17
hayley
Eh, nowadays one has to handle caching and the so-called "allocation wall" when you want to allocate faster than primary memory allows you to.
7:01:19
hayley
On the other hand, caches aren't a new invention, and they've always been annoying (though probably more now than ever before).
7:02:25
hayley
"Because the write bandwidth is so limited, we propose the following hypothesis: the scalability and performance is limited by the object allocation on emerging multi-core platforms for those objects-allocation intensive Java applications, as if these applications are running into an "allocation wall"."
7:02:52
Lycurgus
but still it's just java has a much wider compass that opens up for that to make sense
7:03:08
hayley
It applies to Common Lisp just as much as any language (something similar happens in Haskell too). Perhaps even in any language with dynamic allocation.
7:05:28
hayley
Here is a paper on the same phenomenon in Haskell: https://www.cs.tufts.edu/~nr/cs257/archive/simon-marlow/local-gc.pdf
7:05:42
semz
That Emery Berger talk is really good. Great case of a solution that seems obvious in retrospect.
7:11:46
hayley
beach: For what it's worth, I am aware that Hertz and Berger also designed a "bookmarking" garbage collector, which allows for performing conservative collections without thrashing, when some of the heap is paged out. It might be useful for collection in CLOSOS.