libera/#commonlisp - IRC Chatlog
Search
4:22:44
kagevf
I'm hesitant to read non-CL books, but I'm considering making an exception for sicp ... or maybe I should try to work through it in CL??
4:23:19
White_Flame
I don't recall any mismatch with standard CL, though. if any, it would be quite minor
4:23:20
mfiano
And, even though CLtL2 defined CLOS, it was not widely agreed upon yet, and as such, the book uses structs exclusively.
4:24:09
lisp123
kagevf: Actually I find learning a bit of scheme helped liberate and further my understanding of CL. It's not hard to pick up, but eventually you get to know of the differences between the two languages and IMO it makes you better at CL
4:27:40
mfiano
This channel is about Common Lisp. If you want to talk about other Lisps, there is #lisp
4:29:03
lisp123
kagevf: I have to jump, but I'll send you my .emacs settings for Scheme in a few days. Ok no more scheme in this chat :)
4:33:23
White_Flame
hmm, Psybur is gone, but #2a(#.(coerce "abc" 'list)) is a very hacky way of making it a syntactically 2d vector of chars
4:44:01
asarch
If (foo) calls (bar) and then it calls (baz) to finally calls (spam), is it possible to know where in that in-between process is taking so long time and why?
4:47:08
asarch
I suspect it is in a string concatenation process after doing a query to a PostgreSQL cluster
4:48:31
asarch
The String concatenation process parses the query output to set it up into HTML elements to respond the message
4:53:05
hayley
Oh, okay, this function is being called from another thread, so you cannot interrupt it that easily.
5:03:25
beach
asarch: You need to start reading the documentation of the Common Lisp implementation you are using.
5:09:26
beach
asarch: If you did that, you would have found this chapter: http://www.sbcl.org/manual/#Profiling
5:20:04
White_Flame
"regular" profiling instruments functions. stastical profiling just interrupts every N milliseconds and sees what functions are on the stack
5:25:31
mfiano
A nice side-effect of the latter is it annotates the lines of #'disassemble with sample counts
5:26:52
hayley
Also note that the counts tend to be on the wrong instructions, usually on the instruction after.
5:32:30
hayley
WITH-PROFILING won't work too well if you already have a server running, and additionally if you create new threads in the body, from experience.
5:32:41
asarch
Yeah: (sb-sprof:with-profiling (:max-samples 1000 :report :flat :loop t :show-progress t) (cpu-test 24))
5:33:50
asarch
In my case, I do: (defun foo () ...) and some other function calls it for me when the user visits "/foo"
5:34:32
hayley
(sb-sprof:start-profiling) <do some stuff you want to profile> (sb-sprof:stop-profiling) (sb-sprof:report :type :flat)
6:02:01
hayley
There's a fair bit of compiler noise, because you profiled loading the file too. But (SB-PCL::FAST-METHOD ELEMENTOS:RENDEREAR (ELEMENTOS:INDICE)) still sticks out.
6:04:29
asarch
" 1 617 25.3 880 36.1 617 25.3 - (SB-PCL::FAST-METHOD ELEMENTOS:RENDEREAR (ELEMENTOS:INDICE))"
6:18:42
hayley
One option would be to collect each rendered row into a string, and then concatenate from that list (e.g. (format nil "~{~a~}" rows)). Though it also would be a good idea to use a HTML library such as CL-WHO.
6:19:42
asarch
That function takes the code from the query, parses its components and the passes the result into the template to make this: https://pasteboard.co/7LEpyJx8qqZp.png
6:20:40
mfiano
hayley: In an email I sent him, asking him why he recommended others over his own in Common Lisp Recipes.
6:26:44
hayley
I don't think there are good answers for that question right now. You probably aren't going to concatenate strings any faster than CONCATENATE; you need to avoid concatenating big strings repeatedly.
6:27:20
beach
asarch: How big? I am asking because lots of people, even very smart ones, overestimate the amount of memory required.
6:27:54
hayley
beach: The problem is that asarch is performing (setf accumulator (concatenate 'string accumulator another-string)) in a loop.
6:32:39
mfiano
It seems most of that string can be cached at accessor writing time and read at render time.
6:35:56
asarch
However, which other way could parse every element of the original string, give a format and the save the result into a variable?
6:39:06
mfiano
If I understand correctly anyway. This is an algorithmic problem, not really that of a data structure (string)
6:44:22
asarch
A fellow from C# was talking about the ConcurrentBag object when you need multiple instances of complex objects and you don't want to allocate memory constantly