Re: 4.0 and include statements
- Posted by RStowasser Jan 18, 2009
- 928 views
In 4.0, when it parses a file, and it resolves a symbol to a global symbol in another file that wasn't included by the current file, it treats this as a forward reference, since there could be a matching symbol somewhere else either in the same file, or in another file that was included, and we don't want the errant global symbol to override the symbol the programmer actually wanted.
So when the IDE is parsed, over the entire course, it ends up with over 60,000 unique forward references (this includes things like type checks). Which really, really slows down the parsing. I went through and added include ide.exw to the files, and the parsing time was drastically reduced. Note, it would have been better to have included the specific files that were used, but this was easy, and I just wanted to see the difference.
I hesitated until now, but I think this topic should be addressed.
If I run the original IDE.exw (I had to change int to integer in some files), using exw rev 1339 takes more than a minute to start the splash screen. With Eu 3.1.1 it takes 4 to 5 seconds. Using my Task-Manager I can see that using Eu 4.0 IDE consumes about 296 MB(!) of RAM. With Eu 3.1.1 it will use about 22 MB.
As an exercise I made a copy of IDE.exw and replaced the include statements of IDE with the real code of the include files, changing the names of redundant symbols and routines or commenting out some of them (like ok, void etc.)
As a result I got a relative identical big IDE in one file which starts as fast as with Eu 3.1.1. (4 to 5 seconds) It uses 20.6 MB of RAM with Eu 4.0 and 21.2 MB with Eu 3.1.1.
There is a similar behaviour with wrapper.e of the EuGtk2 files. With Eu 3.1.1 it will use 4 MB of RAM, with Eu 4.0 rev 1339 it will consume 179.6 MB.
I do not understand why it makes such a difference if I use global symbols with Eu 4.0 and why it will consume so much memory when creating bigger sized applications, no matter if I see them as forward references or not. As the code of Eu 4.0 is far beyond my capabilities I cannot make any suggestion. But is it not possible to treat global symbols in include files without public or export the same way as with Eu 3.1.1?
Roland