ATell-SoundTheory / CliffordAlgebras.jl

A fast and lightweight Julia package for Clifford and geometric algebras.
https://atell-soundtheory.github.io/CliffordAlgebras.jl/
MIT License
36 stars 4 forks source link

make tests run much faster #16

Open jw3126 opened 1 year ago

jw3126 commented 1 year ago

Before

julia> @time include("test/runtests.jl");
Test Summary:       | Pass  Total     Time
CliffordAlgebras.jl | 2511   2511  2m53.5s
197.829084 seconds (8.98 M allocations: 1.078 TiB, 37.20% gc time, 12.09% compilation time)

After

julia> @time include("test/runtests.jl");
Test Summary:       | Pass  Total  Time
CliffordAlgebras.jl | 2511   2511  0.2s
 26.239201 seconds (7.46 M allocations: 637.263 MiB, 1.01% gc time, 97.76% compilation time)
jw3126 commented 1 year ago

The issue was that CliffordAlgebra(9, 6) creates a Tuple of size 2^15. Julia does not like such big tuples. I think the best solution might be to not store the base indices as a Tuple but as a lazy struct. This PR at least fixes issues with the big tuple when running the tests.

ATell-SoundTheory commented 1 year ago

Thanks, Jan. I was aware of the issue with the big tuples but don't think there's an easy fix. Like you say, evaluation when needed would be one way. But that would require some major code changes.

I'm not sure if fixing it just for the test runs is a good idea. I'll have to understand what you did there, first.

jw3126 commented 1 year ago

I guess most people including me don't actually need these high dimensional algebras. But slow tests affect everybody. The tests only instantiate some big algebras, but do nothing else with them. I made instantiation fast.

ATell-SoundTheory commented 1 year ago

I guess I'll try to replace the tuple with something that quacks and walks like a tuple but is really a lazy evaluated expression. Do you happen to know if someone else already has written a library for that?

jw3126 commented 1 year ago

I don't know a library that can help here. If you want we could chat about how to do this or code it together.

chakravala commented 1 year ago

There is a library which does lazy evaluation for geometric algebra, it's Grassmann.jl, since you're not my collaborators I won't necessarily go into the details of it here. However, it surely does do lazy evaluated type things in certain circumstances such as high dimension. I've been concerning myself with such issues for years already. In Grassmann such issues have been thoroughly thought about already for years and the user does not need to concern themselves with such details as it is an internal detial

ATell-SoundTheory commented 1 year ago

@chakravala Yes, Michael, I'm well aware of your library, so you can stop mentioning it here. The point of bringing up this issue is clearly improving this library and not switching to another library.

ATell-SoundTheory commented 1 year ago

@jw3126 I'd love to do that. Unfortunately I'm knee-deep into a C++ project at the moment and switching to a Julia context would require some effort. But maybe we could meet for a play date some time and discuss the issue when the kids are busy?

chakravala commented 1 year ago

The point of bringing up this issue is clearly improving this library and not switching to another library.

The irony is that I have solutions to your problem, but you are from the start antagonistic by having your own exclusive project instead of discussing anything with existing projects.

ATell-SoundTheory commented 1 year ago

@chakravala If you find creating an alternative project to yours antagonistic then I think you should consider spending your time with things other than open source software development. Honestly, your attitude seems to be the problem here, not mine.

jw3126 commented 1 year ago

@jw3126 I'd love to do that. Unfortunately I'm knee-deep into a C++ project at the moment and switching to a Julia context would require some effort. But maybe we could meet for a play date some time and discuss the issue when the kids are busy?

Yeah sounds good!

chakravala commented 1 year ago

@ATell-SoundTheory you literally just wrote an antagonistic comment saying I should not do open source programming, it is evident that discussing my solutions with you is not worth it, but I have mentioned it for other readers

ATell-SoundTheory commented 1 year ago

@chakravala Way to deliberately misunderstand my statements, Michael. It should have been clear that I was merely pointing out that creating alternatives is an essential part of open source software, and if you feel threatened by an alternative project then you should not expose yourself to this entirely normal situation. You, on the other hand, invade the discussions of other people pointing out the superiority of your project all the time. Do you think that way you'll get the attention that you believe you deserve? Say, are you still banned from Julia Discourse? And do you still rant about it on reddit pretending you are someone else? Please refrain from commenting in this project in the future unless you have something to actually contribute.

chakravala commented 1 year ago

Of course I am genuinely interested in being of assistance on @jw3126 issues of high dimensional geometric algebras, as I am interested in challenging the capabilities of my software development with Grassmann. As far as that whole julia language gossip thing about me you are mentioning, it's not something to do with you, or is it? It seems the Julia language is primarily concerned with gossip about me, if that topic interests you, this seems off topic here.