Today I did try to make an interesting project as I had a great user oriented idea.
Because I made as simple observation: NaroCAD (and any project in general) use a lot less of the API it has access. Also NaroCAD should be not bloated. .Net 3.5 in itself is huge. Also the OpenCascade may be huge. But NaroCAD is a project that needs to be changed pretty often so it may be useful for users to not download a 30M package only to test it. In fact NaroCAD in itself including almost all dependencies, it is 8M package, excluding the file I will talk next.
The single problem is about OCWrappers, which contains wrapper code to almost a half of OpenCascade library, and is not less than 19M compiled. This are in themselves dummy and they are used as much as Naro grows. But what if Naro uses only a half? Should not be much wise for users to have only used wrapper part?
Naro in itself do not use for instance OCAF. Only removing OCAF from wrappers, will make a a reduction of 2M. The problem appears still that what if tomorrow we will use it. Or what if we remove a thing, and compiler will complain. This will make for developer that want to create a minimalist wrappers a tedious task. Is really to heavy to take in account every linking error or every relation. Also, you can do on other way: you start minimialist and you wait compiler to complain. For every class it complains, you add to your wrappers. Because by references the relations are more than 1000 classes right now from 2300 wrapped, for certain a lot of persons will run away for this job.
But I know someone who will not... This is the computer!
NaroLinker is a program that does this:
1 - Start from an empty wrapper.
2 - Compiles it.
3 - it offer to NaroCAD and tries to build it.
4 - NaroCAD will complain: I miss this classes!
5 - NaroLinker will add to that wrappers project the classes needed
6 - NaroLinker will try to build this wrappers. Because this classes may need anothers, NaroLinker will add them one by one
7 - NaroLinker will recompile the wrappers and add dependency classes till it succeds
8 - Go to step 3 until NaroCAD may have all symbols solved and the process stops here.
Also, there is a possibility to add your own used classes (care, they should be from already wrapped packages!), so if you have wrapped circle but you know that you need ellipse, you will be able to add it even is not used by NaroCAD and rebuild everything nicely! (this is why Add Class button stands for)
How good is it?
In current usage the compiling time goes from 35 minutes to compile the original full wrappers to around 40 minutes (because around 40 compilations and linkages are involved) but the final wrappers goes to 8M. This dependencies are fully working as they are requested explicitly by code or are dependencies of the used classes. The installer saves 1M compressed, which is in fact a 11M on disk. So right now instead 3.9M, the installer goes in 2.75M.
As a developer I still recommend full sized wrappers. They offer all wrapped packages, not only used one, but from a QA or user perspective, a slimmer binary is much better. The other small advantage, is that if you have a 2G machine, the full sized wrappers at least on Vista64 (my machine), the linking step of all 2000+ classes may get over 2.5G, when the 1100 classes used by smaller wrappers may make the compiling of wrappers to be faster on that machine. Also, if you will use the reduced wrapper, and you work on NaroCAD at least for testing purposes, you can have at least a significantly reduced wrappers so are easier to be search and faster to navigate on them. The linker remove unused classes not unused methods, so you will have still a coherent assembly that contains the wrappers!
Note: I work to add extra attributes to items to not be displayed in trees or to appear in Layers. More on them tomorrow!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment