06-02-2022, 12:16 AM
(06-01-2022, 10:36 PM)Dav Wrote:(06-01-2022, 07:22 PM)James D Jarvis Wrote: Just reading the code and wondering why you never free fontsheet& , is that because you passed it to _Memimage ?
No, to increase speed when calling the SUB more than once. I decided it better to make fontsheet& only once and just leave it open for the whole program run, so the image doesn't have to be decoded/created every time the SUB is called. I plan to use this for things that need fast drawing. In my testing this increased speed over 10x. I could call the SUB 1500 times in one second this way, but only 135 times a second when freeing the image and having to make it over every time. I usually don't like to leave images hanging open, but in this case thought it worth it for the speed gain.
- Dav
Is there something gained by doing this in the sub and keeping track of the memory location as opposed to doing it outside the sub but with a shared handle created before calling the sub? (sorry about the questions, just getting into really paying attention to memory usage as a feature to speed execution as opposed to just being able to hold onto data and make use of it).