Jump to content
dormky

How come .dcu files aren't the same across builds ?

Recommended Posts

Posted (edited)

When I build .dcu files, they often aren't the same size. Does anyone know why that is ?

I literally just build two times in a row, and between 5 and 10% of .dcu will have a size difference of a few dozen bytes.

 

I'm trying to apply formatting to the whole project and want to verify that the output is not affected (trust but verify, heh ?) but if building the same thing twice already leads to significant changes this will be quite difficult to achieve...

 

And yes, we have 0 test coverage.

 

Edit : Example with this small file, where 4 bytes are added at around 3/4ths of the file.

UConfigEchelle_big.dcu

UConfigEchelle_small.dcu

Edited by dormky

Share this post


Link to post

Well, I just checked on the effects of formatting on .dcu files and they seem to be affected a lot. Very strange that intermediate compiler files would be affected by formatting. Does delphi output other intermediate files that I could check ?

Share this post


Link to post
16 minutes ago, dormky said:

Does delphi output other intermediate files that I could check ?

Hm, maybe the map file?

 

Do you build dcu files containing debug information? If yes, the debug information contains a line number, so the size might change if the number of lines containing code changes. There might be other kinds of information in the dcu which are similarly affected. The dcu format isn't documented, but I remember a project on GitHub that could read them - at least get identifiers out of them - so maybe that project also contains some kind of documentation or at least parsing code that might shed some light on this.

Share this post


Link to post
17 minutes ago, dummzeuch said:

Hm, maybe the map file?

 

Do you build dcu files containing debug information? If yes, the debug information contains a line number, so the size might change if the number of lines containing code changes. There might be other kinds of information in the dcu which are similarly affected. The dcu format isn't documented, but I remember a project on GitHub that could read them - at least get identifiers out of them - so maybe that project also contains some kind of documentation or at least parsing code that might shed some light on this.

Ah, it might be the debug info indeed for the big changes when formatting. But there's still differences when compiling 2 times in a row, which I can't explain (see attached files in the OP)

Share this post


Link to post

Are you doing full builds or just compiles?  I personally wouldn't trust a compile as it could pick up a stray dcu elsewhere in the search path (possibly with opposing debug info than a full build would generate) rather than the one you would build.  I would expect two builds done back to back to have the same byte signature if there are no other changes.  Don't get me started on .dfm changes when saving a unit that includes one.  The streaming system likes to recompress images (I believe its the color palette) which throws off binary equality, even if no changes were actually made, and there is the possibility that if you touch an inherited component on the form that it will bring in an inherited version in the inherited .dfm as well that serves no purpose.  I also use https://github.com/ahausladen/DDevExtensions and "Remove Explicit properties" from the DFM which also generates quite a bit of useless noise each save, at least when working in a group.

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×