Classes on stack

Steven Schveighoffer schveiguy at gmail.com
Fri Sep 2 13:23:18 UTC 2022


On 9/2/22 12:23 AM, Walter Bright wrote:
> On 9/1/2022 4:58 PM, Steven Schveighoffer wrote:
>> On a somewhat related note, I wish that there would be a way to avoid 
>> the module constructor sorting at runtime, because it is the same 
>> every time, and a waste of CPU cycles to do it. But this can only be 
>> done *after* linking. If there were some way to preallocate space for 
>> the module ctor cycle order, and then run a post-build step to edit 
>> that graph, it would be a great improvement to have.
> 
> How many modules are in your program?
> 

What do you mean? If you are suggesting that probably the module sorting 
is insignificant, it definitely is not very intensive.

What I don't like about it is that it is a sort of immutable data. In 
other words, the data does not change from one run to the next, but it's 
stored unordered, and then every time the program loads, we have to 
order it. Every time a DLL is loaded, this algorithm needs to be run.

It would be nice if it were stored in the order needed, so no sorting is 
needed. The sorting algorithm is complex as well, it's not a simple 
quicksort.

-Steve


More information about the Digitalmars-d mailing list