I’m currently a final year student and my supervisor is into scientific computing. He has a tool that makes heavy use of a DSL written into python and he wants me to investigate whether writing DSL’s in Julia are quicker than python.
I have attempted to write my very first basic DSL which just does symbolic differentiation for basic algebraic expressions, which can be found here: https://github.com/AndrewMonteith/DSLs/blob/master/algebra.jl. I tried to make heavy use of the type system and multiple dispatch to make my language compact (Is this a good idea normally?)
In the code I linked, I’m confused about the behavior of the bottom 2 statements.
Line 122: 27 allocations and 760 bytes.
Line 123: 10.8k allocations and 494kb.
Line 123 is only adding an additional term though, which I would have though is just a few more structs. So is there an exponential increase in allocations?
Further to my above question, I haven’t been able to find many resources on how to make good DSL’s. Any suggestions on resources/general tips for good DSL practices in Julia?