freenode/#lisp - IRC Chatlog
Search
7:32:27
fiddlerwoaroof
I spent a couple hours today trying to figure out how to get my development environment setup again before giving up
7:38:22
muyinliu
can anyone tell me why simple code wrap by defun cost 10x CPU time? demo here: http://pasteall.org/476608/lisp
7:39:52
fiddlerwoaroof
Is there a simple way to implement something like the touch command in common lisp?
7:39:59
clintm
fiddlerwoaroof: if you want to try it all out on the clojure side, there's a video series called parens of the dead. It assumes experience with emacs, but I thought it was pretty well done.
7:43:29
phoe
fiddlerwoaroof: (with-open-file (s "/tmp/goop.lisp" :direction :output :if-does-not-exist :create))
7:44:43
fiddlerwoaroof
The W-O-F snippet handles creating a file, but it doesn't actually have feature parity with the coreutil
7:44:58
clintm
I think you'd have to write to it to update the time. You could also 'touch' it programatically by changing its permissions.
7:47:04
beach
muyinliu: Second, if you have a decent compiler, it will notice that the first expression you submitted does nothing, so it can remove the entire calculation.
7:47:37
beach
muyinliu: Benchmarking is hard stuff, because you need to know enough about compiler design to know what a good compiler is capable of.
7:48:38
beach
muyinliu: And SBCL has a very good compiler in terms of optimizations and performance of generated code.
7:49:37
beach
muyinliu: If you have an application where the overhead of calling a function is unacceptable (which is unlikely), then you can often declare the function INLINE.
7:54:11
beach
muyinliu: Even if SBCL does not remove the entire calculation in the first case, it will recognize that you have an addition of two constant numbers, so it will perform this addition at compile time, effectively generating a constant. A function call is definitely much more expensive than computing the value of a constant, because in the latter case, the constant is just returned.
7:54:39
beach
muyinliu: So you see why it is important to understand what the compiler is capable of if you are going to make benchmarks like this.
7:57:32
muyinliu
beanch: after wrap the C call with defcfun to create my get-universal-time, it's much more slow than SBCL's get-universal-time.
7:59:33
muyinliu
beach: the only diff is that SBCL use syscall directly and my version call with a defcfun
8:00:15
beach
muyinliu: I think the benchmark you showed us have very little in common with the real thing you are trying to measure.
8:03:35
beach
muyinliu: I know very little about FFI stuff, but my guess would be that there is a lot of time spent in converting data between the way SBCL represents things an d the way C represents things.
8:05:12
beach
muyinliu: If so, the benchmark you submitted has absolutely nothing to do with your original problem.
8:05:57
muyinliu
beach: I don't think it's about CFFI. I compare same code between Common Lisp and Clojure, Clojure's function version is only take 2 times of the CPU time(Common Lisp's function version take 10 times of the CPU time).
8:08:19
phoe
beach: technically speaking, Java has its Java Native Interface, and Clojure is capable of leveraging that.
8:08:56
beach
muyinliu: So if Clojure is not using CFFI but SBCL is, what made you conclude that this additional time is NOT due to CFFI?
8:14:48
beach
muyinliu: For one thing, the cost of a function depends on the implementation, not on the language.
8:15:34
beach
muyinliu: Second, it depends on the safety of the code. In safe code, many things are checked. If you compare to something else, you have to make sure that the same work is done.
8:16:17
beach
muyinliu: Third, your problem was with FFI, but then you benchmarked an ordinary Common Lisp function call.
8:18:31
beach
muyinliu: Fourth, you executed the call (or so we think) one hundred million times. That means the call took 4ns or so. That is not very much.
9:06:49
otwieracz
I've got some function running in thread - is there any way to interrupt it, so I'll have debugger in it's context?
9:27:18
antoszka
otwieracz: This shouldn't make a difference, I think the swank protocol is network agnostic.
9:30:36
phoe
well - if it does not react to any interruptions or attempts to enter the debugger, I bet it's time for it to die, then.
9:42:15
closkar
otwieracz: I've often had the same problem. Just to confirm that your issue is not local to your system.
12:03:39
phoe
I have just successfully tested CL-LZMA on a different linux64 machine. Like, git clone into local-projects, quickloading, running the tests.
12:04:02
phoe
Once I get the libraries compiled for win{32,64}, mac{32,64} and linux32 - I think I can ship it.
12:09:07
phoe
I'll compile this on Windows and Mac when I get home. For Windows, I can cross-compile with mingw; for Mac, I'll finally install a programming environment on my hackintosh.
12:14:51
phoe
Like - can I request adding a project to Quicklisp, if the project only loads under linux64?
12:24:12
phoe
axion: it should work on any implementation that supports CFFI, and it does support only linux64 at the moment with more in plans.
14:42:53
franogrex
hi I have something like (loop for line = (read) while line do ... finally (return line))
14:43:23
franogrex
basically i want to only retain the last reading and the intermediate results i don't case about
14:53:02
phoe
Lisp test framework question. Is there anything in Lisp that allows me to do stuff like http://paste.lisp.org/display/351234 ?
14:53:41
phoe
Basically - declare what a test case should do in terms of test steps, then define its implementation while marking the individual test steps, then use that information when displaying error information?
14:57:36
phoe
dlowe: I know that there are test frameworks that will signal errors, but I want specifically something that also stores human-readable test step descriptions.
15:04:37
rpg
Does paredit have any command that will "snug up" a bunch of dangling parens that have ended up stranded on a line by themselves?
15:11:41
rpg
schweers: that only works if there is no whitespace at the end of the current line, and if the close parens appear on the very next line.
15:13:11
rpg
I find I often end up with parens off on lines by themselves while I'm filling in a structure like a set of class slot definitions, a set of let bindings, etc.
15:14:59
rpg
common use case where nothing is wrong: comment out a final let binding. Drop the closing paren to the next (empty) line so it doesn't get eaten by the comment. Test. Remove the commented-out block. Paren left stranded. No paredit bug AFAICT, no programmer error.
15:16:47
schweers
I can’t really comment on paredit, as haven’t used it for a while, but lispy does this, and I’m pretty sure the two are somewhat identical feature-wise
15:17:45
schweers
i.e. when point is at "|" in this expr: (let ((var1 ...)|(var2 ...))...) using paredit-comment or whatever should do The Right Thing
15:19:09
schweers
does this help you? https://stackoverflow.com/questions/4288339/how-do-you-comment-out-all-or-part-of-a-lisp-s-exp-using-paredit
15:47:29
rpg
I like paredit, but there are definitely cases where it feels too rigid (like where I want to copy a set of let bindings, but not the body that comes with it. I would like it more if it were easier to say "yes, I know that the parens are messed up, and now I'm fixing them."
15:59:36
SAL9000
np! smartparens by default is 'non-strict' in that it doesn't prevent you making (or fixing) messed up parens
19:13:14
clintm
How would I get the actual error from a error with asdf running a grovel operation? A header is probably missing, but there's no helpful message at the top of the slime buffer to guide me.
19:17:08
phoe
...so if my question about testing frameworks was not answered, I think it's time to write some Lisp.
19:29:14
clintm
oooooh, the errors went to the terminal the image is running on and not over swank. Good to know.
19:31:14
phoe
this sounds like a bug. if they're Lisp errors, then these errors should definitely go to the swank output.