luna-is-here has quit [Remote host closed the connection]
luna-is-here has joined #commonlisp
rotateq has quit [Quit: ERC (IRC client for Emacs 27.2)]
robin has joined #commonlisp
zachel has quit [Read error: Connection reset by peer]
mgl has quit [Ping timeout: 256 seconds]
zachel has joined #commonlisp
c has joined #commonlisp
c has quit [Client Quit]
c has joined #commonlisp
c has quit [Client Quit]
ec has quit [Ping timeout: 240 seconds]
Common-Lisp has joined #commonlisp
orestarod has quit [Ping timeout: 250 seconds]
Bike has quit [Quit: Lost terminal]
Oladon has joined #commonlisp
zacque has joined #commonlisp
pranavats has joined #commonlisp
random-nick has quit [Ping timeout: 240 seconds]
s-liao has quit [Quit: Ping timeout (120 seconds)]
s-liao has joined #commonlisp
morganw has quit [Remote host closed the connection]
s-liao81 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
pranavats has left #commonlisp [Error from remote client]
s-liao81 has quit [Client Quit]
Oladon has quit [Quit: Leaving.]
gxt has quit [Ping timeout: 240 seconds]
gxt has joined #commonlisp
akoana has quit [Quit: leaving]
Bike has joined #commonlisp
sloanr has quit [Ping timeout: 240 seconds]
masinter has joined #commonlisp
Inline__ has joined #commonlisp
Inline has quit [Ping timeout: 240 seconds]
molson has quit [Remote host closed the connection]
molson has joined #commonlisp
asen has joined #commonlisp
s-liao has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
<neominimum>
How do you personally make it obvious what the architecture of your projects are? I feel like the only way to define an explicit layered architecture between code modules is to create a new system, as simply defining a new namespace with defpackage doesn't give any hints as to where in the architecture it sits unless one creates a package naming convention.
<neominimum>
e.g., `PROJECT/RUNTIME` re-exports `PROJECT/LAYER-ZERO/RUNTIME-INTERFACE`, which may import `PROJECT/LAYER-ONE/CONTROLLER` or another layer-two module, etc.
<neominimum>
I guess even creating a new system and using`:depends-on` to declare dependencies may hide the architecture without support from some tooling. Would it be considered odd to create a system for a single file, single defun module to denote it's relationship between other modules?
sbodin has joined #commonlisp
<beach>
I tend to divide the code into "modules", where each module is in a separate directory, has a separate ASDF system definition, and a separate package.
<beach>
So a "module" has at least three files, the .asd file, the package(s).lisp file, and at least one file with code in it that has (in-package #:module-package) in the beginning.
<beach>
... and Good morning everyone!
Tallund has joined #commonlisp
<neominimum>
beach: I recall looking through cluffer and finding the organisation of the modules to be very understandable. I was wondering if I should attempt a similar method. Good morning to you!
<beach>
I see.
<neominimum>
I think it was similar to what you just outlined above.
<beach>
Yes it is.
Tallund has quit [Quit: Client closed]
<dbotton>
are there any tools for seeing what objects are slated for gc, what memory foot prints are etc I want to be able to see life spans of objects etc
<Bike>
the most basic tool is the cl:room function, which will probably give you a breakdown of memory usage
<dbotton>
thanks
<dbotton>
I feel insecure with gc
<beach>
If you could see what objects are dead, they wouldn't be dead.
<dbotton>
I spent my life with carefully watching my code etc so just want to feel nice and fuzzy
<neominimum>
I tried once to work out the memory footprint of some compound objects I had, but I found that, sbcl at least, won't follow references when tallying up the slots as it could lead to infinite recursion(?), not 100% on that but I gave up on trying to figure out if it was possible.
<beach>
neominimum: Right, because you would then get the class of the object, all the superclasses and subclasses, all the methods of all the generic functions that apply to any of those classes, etc.
<beach>
Most of those things are shared between a large number of objects, so it would be strange to count it as the memory footprint of a single object.
luna-is-here has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 240 seconds]
<Bike>
it might conceptually be one object in your application, but the implementation doesn't know that
<Bike>
detailed metrics on memory usage could be kind of neat, though
<neominimum>
beach: Ok, I see. I wonder though if there is a way to only consider certain aspects of the object like only a few slots or something, but then declaring that would be a manual process for each class of object if that were even possible. I really have know idea how the object system works under the hood though so anything I say is simply wishful thinking.
<Bike>
another thing you can use is the profiler; i believe sbcl's at least has a memory tracking mode
luna-is-here has joined #commonlisp
semz_ has joined #commonlisp
<beach>
neominimum: I don't know. I have never found it relevant to consider the space used by anything other than the object itself, and that space is pretty much determined by the slots of its class and its superclasses.
semz has quit [Ping timeout: 256 seconds]
semz_ is now known as semz
<dbotton>
are there any situations that are likely to create "memory" leaks in CL to watch out for?
<dbotton>
(beyond foreign functions)
<beach>
Definitely! Consider a gap buffer, i.e. a vector where only some elements are considered "live". When you remove an element from the gap buffer, you must set the element to something "neutral" like NIL or 0.
<semz>
Symbol pollution is another pitfall if you intern symbols from untrusted sources (e.g. turning JSON keys into keywords)
<semz>
since the interned symbols remain reachable through the package
<dbotton>
so keyword package even worse I assume
<edgar-rft>
also old natural language processing programs from the 1980s interned lots of unnecessary symbols
<dbotton>
so using dbi would create but minimal
<semz>
The keyword package is usually the affected one
<neominimum>
beach: IIRC I had a highly concurrent workload where the memory growth was killing sbcl (my fault in the way I structured the release of the object creation and ensuing function calls). The object was a proxy that held objects, that held other objects, so a nested structure. And I was unsure about how to manually add up the space used by all the objects without making a mistake.
<neominimum>
I only needed it so I could reason about the memory growth characteristics, but I did consider whether it would be possible to use that information to automate the release of parts of a parallel computation in a way that maximised resource usage while not exhausting the heap.
<semz>
usually not a problem in common use, but when you can have a malicious party on the other end, it's a DoS vector
<beach>
neominimum: The basic rule is that you should set a slot to some neutral value when you no longer need the object it contains.
<dbotton>
If I store a lambda from inside a defun in a hash, it and local vars that it referenced will not be gc'd correct?
sbodin has quit [Remote host closed the connection]
<dbotton>
(I am sorry if a foolish question)
<neominimum>
beach: Yes, this is probably getting a little OT, but the only problem was that all of the proxy objects were still needed as as none of processes that used them had finished their part of the computation yet. As effectively they were operating in lockstep and creating a lot of junk (well, message sends) as they went (again my fault for structuring the computation that way).
sbodin has joined #commonlisp
<dbotton>
I just realized that I think I was overly concerned with leaving the scope of functions and that somehow the lambda and allocations in those functions could be gc'd
<neominimum>
To be clear, being able to just query the foot print of the proxy object wasn't going to fix the issue, but I did need the information to start to reason about how I might fix it.
<Bike>
dbotton: it's kind of the point of automatic memory management that you don't need to worry about when things are freed (unless you are doing optimization maybe). if there is any way for you to get at an object, it will not be gc'd. nothing will be deleted out from under you.
<Josh_2>
Good morning
sbodin_ has joined #commonlisp
sbodin has quit [Ping timeout: 256 seconds]
sbodin_ has quit [Quit: -a- Connection Timed Out]
sbodin has joined #commonlisp
Bike has quit [Ping timeout: 272 seconds]
s-liao has quit [Quit: Client closed]
<beach>
dbotton: There is no such thing as "a lambda". There is "lambda expression" and "function" (resulting form the evaluation of a lambda expression". It is usually not relevant how a function is created, using LAMBDA, DEFUN, MAKE-INSTANCE, or something else.
<dbotton>
appreciated
robin has quit [Ping timeout: 240 seconds]
robin has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
azimut has quit [Write error: Connection reset by peer]
wyrd has quit [Read error: Connection reset by peer]
gxt has quit [Read error: Connection reset by peer]
azimut has joined #commonlisp
gxt has joined #commonlisp
anticomputer has joined #commonlisp
wyrd has joined #commonlisp
<dbotton>
this conversation touched 50 files... There was no point in me keeping an extra thread open to prevent local variables going out of scope to a lambda expression
<dbotton>
That was a decision from a year ago only 2 or 3 months in to lisp
<beach>
Is Common Lisp the first language you use that has automatic memory management?
<dbotton>
yes
<dbotton>
Well some java but nothing major
<dbotton>
But also first time dealing with closures
<beach>
I see.
<dbotton>
well outside of downward closures
<dbotton>
So let over lambda is new
<beach>
Interesting.
<dbotton>
That was the reason for keeping the thread, I was afraid the local variables going out of scope would be potential issues
<beach>
I think this is the first time I hear about someone having this model in mind of how things work.
<beach>
Yes, I understand.
aartaka has joined #commonlisp
<dbotton>
I think any one with out lisp experience would likely run in to this issue
<beach>
Though I guess this model is consistent with how C++ works.
<dbotton>
sorry which model, let over lambda?
<beach>
The model that a live object could be reclaimed by the GC just because a variable that has that object as a value goes out of scope.
<dbotton>
Right can happen easily in C++
<dbotton>
Well sans the gc
<dbotton>
So throw gc in and you make defensive assumptions
<dbotton>
I figured if I was wrong I could just remove the "run" function later as I just did
<dbotton>
Most expect that GUIs have a run loop, so seemed natural.
<dbotton>
Now that I know there is no need, no need to give a false impression there was one.
<dbotton>
There is no event loops etc in CLOG. New events coming from the browser launch threads that you can run in parallel or synchronized
<dbotton>
I still left the ability to leave that creation thread for those that want to run code post disconnect of the browser
<dbotton>
like to databases etc
<dbotton>
sorry - disconnect from databases etc
asen has quit [Quit: Leaving]
<masinter>
i imagine common lisp is better learned from the inside out
<masinter>
you have to clear your mind of any thoughts about allocating storage
<masinter>
like with JavaScript
<dbotton>
I changed my approach after realizing how different lisp is
<masinter>
javascript is very lispy
wyrd has quit [Remote host closed the connection]
anticomputer has quit [Write error: Connection reset by peer]
azimut has quit [Write error: Connection reset by peer]
gxt has quit [Read error: Connection reset by peer]
<masinter>
not in any of the details but the attitude about memory
wyrd has joined #commonlisp
anticomputer has joined #commonlisp
azimut has joined #commonlisp
gxt has joined #commonlisp
<masinter>
for novices -- until you want performant code
pranavats has joined #commonlisp
<masinter>
#lispcafe
<edgar-rft>
performant code is offtopic in #commonlisp :-)
<dbotton>
I was at the time seeing the gc as another thread that could affect objects not bound to symbols and not properly seeing that let over lambda is part of the scope of the lambda expression
alfonsox has joined #commonlisp
rotateq has joined #commonlisp
attila_lendvai has joined #commonlisp
s-liao has joined #commonlisp
frgo has quit [Remote host closed the connection]
<flip214>
it's about time that ELS registration opens...
<rotateq>
I can be there online. :) And in 2 years maybe also in persona.
<hashfunc1930>
why is this form ... `(A B C ,(apply #'values '((D) (E) (F)))) ... not returning ... (A B C (D) (E) (F)) ...? instead it returns ... (A B C (D))
<_death>
why should it?
sbodin has quit [Quit: -a- Connection Timed Out]
sbodin has joined #commonlisp
<hashfunc1930>
_death: because ... (apply #'values '((D) (E) (F))) ... evaluates to (D) (E) (F)
<_death>
the backquote form is basically equivalent to (list 'a 'b 'c (apply #'values ...))
<hashfunc1930>
_death: ok, i understand. then why don't the elements (E) and (F) also get put into the list? is there an evaluation/CL rule that i'm not fully comprehending?
<|smlckz|>
what had happened to clisp?
<_death>
when an expression returns multiple values and the receiving end is not prepared to handle them specially, only the primary value is used
<_death>
you can use ,@ to splice elements of a list
<edgar-rft>
the following code would work: `(A B C ,(multiple-value-list (apply #'values '((D) (E) (F))))) except that it's overcompliated nonsesne :-)
<_death>
edgar-rft: it also wouldn't return the result desired by hashfunc1930
<_death>
the only ways to splice are ,@ and ,. (and you should never use the latter)
<edgar-rft>
oh, true, thanx _death
<_death>
well, there's also . ,foo I guess ;)
<_death>
(which wouldn't work inside vectors)
<hashfunc1930>
_death: edgar-rft: ok thanks ya'll. i learned something
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
<flip214>
multiple-value-list _and_ ,@ is required to get all of D E F into the result... or (list* 'A 'B 'C (m-v-l (apply ...)))
Fare has quit [Ping timeout: 240 seconds]
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
epolanski has joined #commonlisp
mogan90 has joined #commonlisp
<pjb>
|smlckz|: nothing special. Basically, the authors/maintainers grow old, and cannot spend as much time on the maintenance as previously, so releases and issue corrections take more time. The same is occuring to ccl apparently. We just need new maintainers.
amk has quit [Remote host closed the connection]
amk has joined #commonlisp
waleee has joined #commonlisp
hashfunc1930 has quit [Ping timeout: 250 seconds]
v88m has quit [Ping timeout: 272 seconds]
v88m has joined #commonlisp
waleee has quit [Ping timeout: 240 seconds]
s-liao has joined #commonlisp
igemnace has quit [Quit: WeeChat 3.4]
hhdave has joined #commonlisp
igemnace has joined #commonlisp
v88m has quit [Ping timeout: 256 seconds]
kevingal has joined #commonlisp
kevingal has quit [Ping timeout: 240 seconds]
kevingal has joined #commonlisp
frgo has quit [Remote host closed the connection]
<beach>
pjb: Also, code factoring between implementations would help.
Lord_of_Life has quit [Ping timeout: 256 seconds]
attila_lendvai has quit [Quit: Leaving]
attila_lendvai has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
s-liao has quit [Quit: Client closed]
dirtcastle has joined #commonlisp
sbodin56 has joined #commonlisp
tyson2 has joined #commonlisp
pjb has quit [Remote host closed the connection]
pranavats has left #commonlisp [Error from remote client]
pranavats has joined #commonlisp
waleee has joined #commonlisp
sbodin56 has quit [Quit: Client closed]
frgo has joined #commonlisp
sbodin has left #commonlisp [#commonlisp]
dlowe has joined #commonlisp
waleee has quit [Ping timeout: 260 seconds]
eugercek has quit [Ping timeout: 272 seconds]
dlowe has quit [Remote host closed the connection]
<Xach>
dbotton: clog does not build today due to a bogus FORMAT call. Too few arguments (0) to FORMAT " limit ~A": requires at least 1. in clog-data.lisp
epolanski has quit [Quit: Connection closed for inactivity]
pranavats has left #commonlisp [Error from remote client]
v88m has quit [Ping timeout: 252 seconds]
occ has joined #commonlisp
sabra has quit [Ping timeout: 272 seconds]
zacque has joined #commonlisp
Lord_of_Life has joined #commonlisp
sabra has joined #commonlisp
notzmv has quit [Ping timeout: 240 seconds]
waleee has joined #commonlisp
v88m has joined #commonlisp
epony has quit [Ping timeout: 240 seconds]
attila_lendvai has quit [Ping timeout: 272 seconds]
rotateq has quit [Remote host closed the connection]
poldy has joined #commonlisp
Inline__ is now known as Inline
notzmv has joined #commonlisp
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pranavats has joined #commonlisp
treflip has quit [Quit: ERC (IRC client for Emacs 27.2)]
aartaka has joined #commonlisp
Cymew has joined #commonlisp
zacque has quit [Quit: Goodbye :D]
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
Cena has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
pranavats has joined #commonlisp
pjb has joined #commonlisp
notzmv has quit [Ping timeout: 240 seconds]
eugercek has joined #commonlisp
morganw has joined #commonlisp
eugercek has quit [Read error: Connection reset by peer]
ec has joined #commonlisp
mogan90 has quit [Remote host closed the connection]
mogan90 has joined #commonlisp
jeffrey has joined #commonlisp
mgl has quit [Ping timeout: 256 seconds]
notzmv has joined #commonlisp
mogan90 has quit [Ping timeout: 272 seconds]
patrice has joined #commonlisp
rotateq has joined #commonlisp
treflip has joined #commonlisp
epony has joined #commonlisp
poldy has quit [Ping timeout: 256 seconds]
cage has joined #commonlisp
<dbotton>
Are there any documents out there that discuss optimizing lisp code for speed, etc? best practices in commercial settings?
<rotateq>
dbotton: Yees there are some I know. So you mastered yet writing correct and well readable code? :)
<dbotton>
My code is extremely readable, and correct with in the bounds of our human ability
<White_Flame>
the biggest speed issue is avoiding runtime type dispatches
<rotateq>
oh how long do you now do CL? that sounds very advanced then
<White_Flame>
so type declarations, safety 0, etc will get you into C speed
<White_Flame>
also, learn enough asm to be able to read disassemblies
<dbotton>
I have no issue with asm
<rotateq>
dbotton: Great, so I can't wait to learn from your code when something comes up next time. :)
<rotateq>
tchniques like memoization can also give you improvements
hhdave has quit [Ping timeout: 250 seconds]
<dbotton>
Please do, you will find some of clog's idioms interesting even though I am still learning more of lisp's 40 years of development rotateq teaches you that language matters least
<jdz>
White_Flame: say no to SAFETY 0. And never advice inexperienced people to do it.
<jdz>
*advise
<dbotton>
And that if I am asking about optimizations it is probably not to soup up a loop writing to a web page...
<jackdaniel>
safety 0 speed 3 and you'll end adding up characters with floats
<White_Flame>
not if your code didn't complain at default safety/speed
<jackdaniel>
so you'll get speed and /safety/ of C
<White_Flame>
(and you had full coverage etc)
<White_Flame>
right
<jdz>
White_Flame: the code may stay the same, but the inputs might change.
<dbotton>
Right that is what I am looking to understand, ie what the various settings mean practicialy etc
<jdz>
And inputs always change.
<jackdaniel>
and as we all know, safety is a key marketing point for (not using) C
<dbotton>
And last thing I want is to be doing that
Fare has joined #commonlisp
<dbotton>
So is there some document that discuss for example those settings? And of course things like White_Flame pointed out type disptach at runtime etc
* jackdaniel
has restrict policy on sbcl for safety 3, debug 3 and speed 1
<White_Flame>
dbotton: the spec leaves a lot of room for implementations to do lots or little with those, so it's not very specific
<jdz>
I once wrote a series of blog posts which touched on optimization.
<White_Flame>
but in practice, adding 2 numbers without the implementation being certain that they're both floats, fixnums (with a fixnum result), etc will result in a full/expensive function call instead of a single addition instruction
<jdz>
dbotton: Some links may not work (I moved the articles from Google platform), so if there's something that should be working and isn't just let me know.
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
<Xach>
it's very implementation-specific as well
<Xach>
what works on sbcl might not work on xbcl or ybcl.
<jdz>
Sure. And now looking at the articles again, I see I've tried to be honest, and just show the approach I took to tackle the problem, not some generic "you do this and your programs will beat C out of the water".
<jdz>
Also, it was a long time ago, I'm a different person now!
<jgart>
My thinking/understanding of the above is that if check-cell-valid-number signals a check-failure then print-html-check-failure is executed.
<jgart>
Is this how the execution flow works in the above code?
<jgart>
Any advice is much appreciated
lispy has joined #commonlisp
kevingal has quit [Ping timeout: 256 seconds]
<jdz>
Advice about what? What you said looks accurate to me.
<Bike>
jgart: print-html-check-failure will be called with the check-failure condition as an argument, and then, if it doesn't return, the signal will continue propagating and possibly end up in the debugger/etc
hhdave has joined #commonlisp
<jgart>
jdz, s/advice/clarification or confirmation
<jgart>
jdz, Bike, thanks!
<jgart>
Bike, "the signal will continue propagating" is hazy for me but I imagine you mean propagating through the stack?
<jdz>
Yes, up the call chain.
<jdz>
I don't think "stack" is mentioned anywhere in the spec (but don't quote me on that).
<jdz>
Nope, it is mentioned in multiple places.
<jdz>
Mostly in the context of "stack-allocation" though.
<Bike>
not through the control stack, exactly
<Bike>
for example, if check-cell-valid-number uses SIGNAL, and PRINT-HTML-CHECK-FAILURE does not transfer control, SIGNAL will just return normally after calling PRINT-HTML-CHECK-FAILURE
<Bike>
Assuming there aren't any other handlers in play
eugercek has joined #commonlisp
<_death>
dbotton: I assume you're talking about optimization in the context of clog, which doesn't strike me as computation heavy.. what do you seek to achieve that's currently not good enough?
<dbotton>
No. Is more for other projects and ideas
<jgart>
So far I have that file called run-tests.lisp and I'd like to call something like `sbcl --load run-tests.lisp` to run the tests in the test.lisp file.
<dbotton>
But CLOG I can certainly squeeze some more performance, but the major changes will be in local apps when I couple more tightly the browser and cut out http in the middle for those apps
<jgart>
I currently get the following if I try to run `sbcl --load run-tests.lisp`:
<jgart>
`The name "QC" does not designate any package.`
<_death>
dbotton: optimize declarations don't change semantics, so if your code doesn't do nasty things, it should work the same
AlexImmortell[m] has joined #commonlisp
<jgart>
What might be my mistake here? Any help is much appreciated.
<Bike>
jgart: you have (in-package #:qc) before loading the qc system, which presumably defines the qc package
<random-nick>
optimize declarations might be changing semantics on sbcl? for example not throwing an error when the standard specifies it should
<random-nick>
but those things happen when you have invalid type declarations, afaik
<dbotton>
_death, I assume it will make no difference especially since CLOG doesn't do anything funky
Psybur has quit [Remote host closed the connection]
Cymew has quit [Ping timeout: 256 seconds]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
<Bike>
seems fine. i mean, you only have one source file anyway, looks like
<jgart>
Bike, I was thinking of moving the conditions to a separate file. wdyt?
<jgart>
Or maybe doesn't matter
<Bike>
with that little code, i wouldn't sweat it
MajorBiscuit has quit [Quit: WeeChat 3.4]
<jgart>
Ok, thanks. More code will be coming soon but I'll worry about it then.
<jgart>
This library will be used in a web UI (spinneret, ningle, clack) to display csv lint checks for uploaded data to the user in the browser in the form of an html table
<jgart>
Now I just need to hook up the functions to the web UI for a basic demo
tyson2 has quit [Remote host closed the connection]
Oladon has joined #commonlisp
Cena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]