kaveh808 / kons-9

Common Lisp 3D Graphics Project
MIT License
585 stars 33 forks source link

Idea for optimization #211

Open kaveh808 opened 1 year ago

kaveh808 commented 1 year ago

If anyone is into optimizing some CL code using SBCL declarations, I suggest trying it on the src/plugins/isosurface.lisp file. The marching cubes algorithm takes several seconds to generate a mesh, as can be seen by running the demos in src/plugins/sdf.lisp.

It might be interesting to see how much this can be optimized, as SBCL has a high reputation for generating efficient code given the right declarations.

kaveh808 commented 1 year ago

Sounds good. Please let me know the results of your tests.

kaveh808 commented 1 year ago

A variety of shapes in kons-9/test/demo-sdf.lisp

kaveh808 commented 1 year ago

There are examples of generating isosurfaces from points, curves, and polyhedra in kons-9/test/demo-isosurface.lisp

Also check out Demo 06 in kons-9/test/demo-flex-animator.lisp (screenshot below)

In general the demo files currently present simple illustrations of how to use the software.

Screen Shot 2023-05-03 at 10 51 11 AM

kaveh808 commented 1 year ago

I added a screenshot above.

Sounds like an interesting project. Curious where it will lead to.

kaveh808 commented 1 year ago

Don't know if this is relevant: https://sb-simd.common-lisp.dev

kayomarz commented 1 year ago

@foretspaisibles are you planning to work on this? else I will give it a try. I haven't done optimization/profiling in lisp before but would like to give it a shot.

foretspaisibles commented 1 year ago

I am still planning but we can try together, it's more fun! :-) What do you think?

PS: Do you have opinions on what should be a proper benchmark?

kayomarz commented 1 year ago

That would be great, thanks :) let me know how and where I can help.

PS: Do you have opinions on what should be a proper benchmark?

By "proper benchmark" above, are you referring to identifying critical areas of code to profile before trying any optimization? Sorry its a naive question but I'm new to optimization and thought its better to clarify rather than remain unsure.

kaveh808 commented 1 year ago

Parallel programming is something we haven't touched in kons-9 yet. Threads, SIMD, etc. I suspect the lowest hanging fruit is optimizing the OpenGL calls.