I've been putting the low-level Blitz mesh creation functionality through some paces lately and I've found that they're a bit on the slow side: in an effort to build a very large number of primitives into a single surface, the code churns anywhere from two to twenty or more times longer when building a primitive manually into a single surface than when calling the built-in Blitz primitive commands to create separate-surface primitives. This doesn't seem so bad if all you're doing is building a couple spheres to toss around, but if you're trying to build several thousands of primitives manually it can slow things down tremendously.
(Side note: please don't ask whether I really need that many objects to toss around. The answer is that yes I do, that it's not for a game, and that preliminary tests with even separate-surface primitives shows that I basically can get the results I want; I just want to speed things up even more by using a minimal number of surfaces.)
So for the question part: has anyone had any success optimizing the built-in mesh creation commands? As far as I can tell I'm building them as fast as can be expected, one tri or quad at a time as necessary, and all inline within a single CreatePrimitive() function.
The feature request part: if it's reasonable to expect that the manual mesh building commands are not meant to compete for speed with the built-in blitz commands, would it be possible to add an AddSurface command, so that once you've modified a specific mesh with positional, scaling and rotation commands you can combine any two objects' surfaces into one?
(note: yes, I can do an 'addsurface' command myself, but the point is speed, and blitz's low-level routines aren't anywhere near fast enough for a solution in Blitz code -- this has to come either from some incredible optimization I'm unaware of, from an addition to the language, or not at all.)
EDIT: as a comparison, to generate ~2500 primitives within the same loop with no other differences takes:
27 seconds with blitz internal primitive commands
61 seconds to generate single surface quads, and
652 seconds (!) to generate single surface primitives.
Obviously the loop does other things as well, but the calls to generate the primitives are the =only= things that change.
(Side note: please don't ask whether I really need that many objects to toss around. The answer is that yes I do, that it's not for a game, and that preliminary tests with even separate-surface primitives shows that I basically can get the results I want; I just want to speed things up even more by using a minimal number of surfaces.)
So for the question part: has anyone had any success optimizing the built-in mesh creation commands? As far as I can tell I'm building them as fast as can be expected, one tri or quad at a time as necessary, and all inline within a single CreatePrimitive() function.
The feature request part: if it's reasonable to expect that the manual mesh building commands are not meant to compete for speed with the built-in blitz commands, would it be possible to add an AddSurface command, so that once you've modified a specific mesh with positional, scaling and rotation commands you can combine any two objects' surfaces into one?
(note: yes, I can do an 'addsurface' command myself, but the point is speed, and blitz's low-level routines aren't anywhere near fast enough for a solution in Blitz code -- this has to come either from some incredible optimization I'm unaware of, from an addition to the language, or not at all.)
EDIT: as a comparison, to generate ~2500 primitives within the same loop with no other differences takes:
27 seconds with blitz internal primitive commands
61 seconds to generate single surface quads, and
652 seconds (!) to generate single surface primitives.
Obviously the loop does other things as well, but the calls to generate the primitives are the =only= things that change.