IRC channel logs

2023-12-01.log

back to list of logs

<old>I have a question regarding data parsing.
<old>say I have a S-Exp form as data
<old>I wonder if it is best to create syntaxes for this form that will expand to srfi-9 record
<old>or use (read) and manually parse de form
<old>s/de/the
<graywolf>Is there any performance difference between (apply + lst) and (fold + 0 lst) ?
<dthompson>both will be slow, but I reckon the first is a little faster because it's less general
<graywolf>Or rather, are there reasons to prefer one or the other? Or is it up to a personal preference?
<graywolf>"both will be slow" is there a faster way?
<dthompson>actually I'd want to benchmark before I saw one is faster than the other. I can't really say for sure.
<dthompson>before I say*
<dthompson>I would just measure them both and see what happens
<graywolf>In that case I will put it into to "does not really matter" bucket, and make a todo to benchmark it when I have a time
<graywolf>Thanks :)
<dthompson>they're both slow in the sense that they don't get to take advantage of fast paths in the compiler
<dthompson>because none of the numbers are known at compile time
<dthompson>but that's a distraction :)
<graywolf>Ah I see, so for example (+ 1 2 3 4) does allow the compiler to take shortcuts, while (apply + '(1 2 3 4)) does not, did I get it right?
<dthompson>yeah, but I shouldn't have mentioned it really. kind of irrelevant here. heh.
<dthompson>I'm just too performance-pilled from spending lots of time optimizing math heavy code