solvespace / solvespace

Parametric 2d/3d CAD
http://solvespace.com/
GNU General Public License v3.0
3.22k stars 483 forks source link

Performance testing models (slow speed benchmarks) #1186

Open ruevs opened 2 years ago

ruevs commented 2 years ago

This is a list of SolveSpace models that have shown performance bottlenecks in the past. Some of them were resolved, some were improved but still are slow.

I have marked all related issues and pull requests (that I could find or remember) with the performance label.

Links to the .slvs models reproducing the problems and the fixes may be useful for performance testing. See also #1020. If the "Fixed on" column is empty the issue is probably still open (or I did not update this list :-)

Source Model Author Fixed on Fixed in
https://github.com/solvespace/solvespace/issues/131
https://github.com/solvespace/solvespace/issues/225
constrainfreeze.zip @whitequark 2020-09-16 workaround https://github.com/solvespace/solvespace/commit/615708440f97570cd7055ec65ec0a3bbe6f8f18d
https://github.com/solvespace/solvespace/issues/386#issuecomment-544301008
https://github.com/solvespace/solvespace/issues/386#issuecomment-998587512
https://github.com/solvespace/solvespace/issues/386#issuecomment-1000371505
https://github.com/solvespace/solvespace/issues/1214#issuecomment-1032521028
profiling.zip
keyb_case_MAX_UNKNOWNS_2048.zip
keyb_case_MAX_UNKNOWNS_4096.zip
gear-64-2.zip
@bmorelbr/>@ruevs<br/@ruevs
@ruevs
2021-12-23 https://github.com/solvespace/solvespace/pull/1159
https://github.com/solvespace/solvespace/pull/594#issuecomment-624983188


intersect_ct1.zip @phkahler 2020-05-08 https://github.com/solvespace/solvespace/pull/594
https://github.com/solvespace/solvespace/pull/616#issuecomment-632057911
https://github.com/solvespace/solvespace/pull/616#issuecomment-632062869
LatheSplineIntersectCylinder.zip
A_wheel.zip
@ruevs
@phkahler
2020-05-23 https://github.com/solvespace/solvespace/pull/616
https://github.com/solvespace/solvespace/issues/759 https://github.com/solvespace/solvespace/issues/972
https://github.com/solvespace/solvespace/issues/759#issuecomment-713442468
perf_test.zip perf.zip
PrismConeNURBSNormalsTangents300.zip
@phkahler
@ruevs
2020-10-23
2020-10-24
2020-10-26
https://github.com/solvespace/solvespace/pull/765
https://github.com/solvespace/solvespace/pull/762
https://github.com/solvespace/solvespace/pull/780
https://github.com/solvespace/solvespace/issues/841#issuecomment-742153838
https://github.com/solvespace/solvespace/issues/932
https://github.com/solvespace/solvespace/issues/932#issuecomment-778506906
8040_finished_constrained.zip
case-vents.slvs.gz
LeliaManya2.zip
[]()
@ruevsbr/>@baryluk<br/@ruevs
2021-03-27
2021-05-13
https://github.com/solvespace/solvespace/pull/973 https://github.com/solvespace/solvespace/pull/992
https://github.com/solvespace/solvespace/issues/939#issuecomment-810641820 https://github.com/solvespace/solvespace/pull/1002
https://github.com/solvespace/solvespace/issues/1186#issuecomment-1364497072 NPW-1.0 @nazar-pc



[]()
[]()
[]()
[]()
@br/>@<br/@

A rich collection of test models - some of them performance related https://github.com/whitequark/solvespace-testcases

rpavlik commented 2 years ago

Do we have copyrights/licenses for each of those so we can include them in a testing repo? Looks like none of mine made the list, but if you find one of mine, CC-BY-4.0

phkahler commented 2 years ago

A_wheel is probably obsolete for perf testing these days. Also, if perf_test is the cylinder with many holes, that was posted to the forum so while technically they put it out in public, we probably don't have proper permission to redistribute it as a package.

ghost commented 2 years ago

The profiling thing I did is under CC-0. Or WTFPL if you prefer it.

ruevs commented 2 years ago

Public domain for all of my models listed in this issue.

@rpavlik can you point me to your models please? I did not find any. It's possible I've missed some others too.

rpavlik commented 2 years ago

Yeah I was trying to find them on GitHub, no luck yet, but I should be able to just find the largest files I've made in the past few years pretty easily.

ghost commented 2 years ago

if that was posted to the forum so while technically they put it out in public, we probably don't have proper permission to redistribute it as a package.

To be clear on this and on @rpavlik's note on licensing, even some posts something publicly it does NOT mean that such type of file/content is free to distribute.

Otherwise there should be warning message on forum:

Who knows where file originally may came from.

Looks like none of mine made the list, but if you find one of mine, CC-BY-4.0

As for my publicly uploaded assets to GitHub & Patreon, I ask to use it under terms of CC-BY-SA-4.0:

baryluk commented 2 years ago

You can take my example model case-vents.slvs.gz (any any other variants of it posted on this github issue tracker) under CC-BY-4.0.

rpavlik commented 2 years ago

Thanks folks for chiming in with your terms! I'd recommend using the conventions of https://reuse.software for the benchmarking repo whenever it gets made: license sidecar files for the models is probably the best we can do without adding a "comment-looking" file header to Solvespace files. We can then use their tool in CI to make sure that any models added also have their license and copyright included. The reuse tool is really handy for these purposes, for repos where people might forget to mark files, there are a wide variety of licenses, etc. (Though honestly I tend to make all my projects reuse compliant these days, I'm a big fan, especially for things I might have to make Debian packages for)

ruevs commented 2 years ago

@rpavlik I did find one of yours here https://github.com/whitequark/solvespace-testcases - I had almost forgotten about that collection :-)

Evil-Spirit commented 2 years ago

The house built by programmer

Input.slvs kladka2.slvs

nazar-pc commented 1 year ago

After a few years I have finally open sourced my PC case model, which is VERY slow: https://github.com/nazar-pc/NPW-1.0

It has many components, if you open case.slvs you'll feel how slow it is (it is much faster now than 3 years ago though) and if you try to modify something, you'll probably start feeling pain.

I hope it is a helpful benchmark of what crazy people might end up using SolveSpace for.

ruevs commented 1 year ago
  1. @nazar-pc that is impressive! Thank you for sharing it. In the meantime, seeing your case someone posted this https://www.thermaltake.com/core-w200.html on Hacker News.
ruevs commented 1 year ago

@nazar-pc today I tried your fully assembled case. Om my machine changes (in other words re-generating the model) takes about 6 seconds. This would have been totally infeasible to work with two years ago.

This will be a very useful test model for anyone that decides to tackle performance in the future.

nazar-pc commented 1 year ago

Absolutely, performance improved A LOT since 2018-2019 when I worked on the model! I believe I created an assembly relatively earlier in the process so I only needed to update it on changes as individual parts evolved and hide most of the things when modifying to get solve/render time down to something that worked acceptably.

I think a specific case of updating when some things change might benefit from something like https://salsa-rs.github.io/salsa/ so that unnecessary recomputation can be optimized away (I mostly do Rust these days).

ruevs commented 1 year ago

I pofiled while loading your model. A quick glance at the results shows that 30% of the time is spent searching for triangle edges in a K-d tree. And 10 of those 30% is spent calculating vector magnitudes (square roots). From one side this is good - there are is no glaring slowness in pieces of the code not directly related to geometry - we removed most of those in 2021. On the other hand this means that further speedups will take more work/thinking. Perhaps part of it will be not re-doing work on things that have not changed - like in the Rust compiler library you linked - but part of it will have to be improving the algorithms.

There was a short related discussion on the forum recently https://solvespace.com/forum.pl?action=viewthread&parent=4967&tt=1673005989

phkahler commented 1 year ago

@ruevs I've got 2 old hard drives sitting in front of me. Hoping to recover some old code I wrote with a very efficient spatial index for finding geometry at a point. If it's not too ugly it might help several O(n^2) algorithms in solvespace to become O(n*log(n)). fingers crosses it's all still on there...

ruevs commented 1 year ago

some old code I wrote with a very efficient spatial index for finding geometry

Ahh you've mentioned this before - I remember.

My time lately is very limited - sorry for that. I have a huge list of things in SolveSpace I want to work on and never get to it :-(

hinell commented 1 year ago

@phkahler Sad you didn't backup your repo. Anyway, the least problem SolveSpace has is the spatial geometry calculations.