Fork me on GitHub
#off-topic
<
2023-06-09
>
Noah Bogart14:06:55

this might be more of a java question, but is there a cost incurred for passing in a parameter to a function that goes unused? (defn foo [a b c] (+ a b)) if c is non-nil, does this have any sort of cost? what if the parameter is passed multiple calls deep and then only sometimes used?

Martynas Maciulevičius14:06:13

From what I understand how Clojure works it creates a class with a method that has these fields. And as you didn't specify that your parameter is of a specific non-Object type (i.e. int) then it means that you pass only a reference. So whatever you pass you only copy the pointer. And I think it won't be optimized away. So if you care that your app won't have any duplicate pointers to things and it's already pricy for you then it has a cost for you. But if you aren't at that level of optimization then you shouldn't care about it.

Noah Bogart14:06:17

yeah, i'm not really worried about it, just curious.

Alex Miller (Clojure team)15:06:47

one more thing on the stack, but generally don't think there should be any cost beyond that

Martynas Maciulevičius15:06:26

What about macros? What if I do a lot of macro expansions in real-time?

Sam Ritchie15:06:13

What does realtime mean?

Sam Ritchie15:06:25

Macro expansions will happen at compile time

Martynas Maciulevičius15:06:35

Ah. I thought about the case when they also happen when I connect to a live app and actually ask it to run new code :thinking_face:

Sam Ritchie15:06:07

If you call eval you’re invoking the compiler

Martynas Maciulevičius15:06:32

Ok. Then it means that I'll not have any problems if I'll connect via REPL because I'll already be using compiled chunks of code and only the top-level macro will be expanded by the compiler as deep as it needs to go.

eggsyntax21:06:30

For anyone else interested in OpenAI's near-to-medium-term plans (or at least the ones they're saying out loud), this summary from an interview with Altman is extremely useful. Definitely includes some things I was unaware of, notably intense GPU bottleneck, scaling hypothesis still holding, stateful API) https://website-nm4keew22-humanloopml.vercel.app/blog/openai-plans

seancorfield21:06:37

The folks in the #C054XC5JVDZ channel are probably very interested in this...