6 Replies Latest reply on Jul 21, 2010 3:48 AM by volker.hetzer

    Library automation performance problem



      Since Mentor wants to get rid of he hkp files we are trying to access the data we need usng automation, in this case .net.

      However, it looks like we are going to be a lot slower using automation instead of the hkp files.

      I attach an example of what we'd like to do, namely extracting the parts and mappings from a library.

      Reading the file using a scripting language (Tcl/Tk) took a few seconds, but now we need 20min!

      Because the library gets dumped a few times a day (into our oracle database, which, in turn feeds

      DxDatabook and a lot of other consumers), this is going to cost our librarians real productivity.


      Could someone please have a look at this C# solution (.NET 4, VS 2010) in case we do something wrong?


      Lots of Greetings!


        • 1. Re: Library automation performance problem

          I've written a VBA (Excel) program, that extracts all properties of our library and it runs about 6 minutes for approx. 18,200 parts. I also tried your C#-program without the console-output and without extraction of cell-, symbol- and gate-information. It runs about 2 minutes longer. The library was on a local drive, because a network drive probably wouldn't be fast enough. In my case it doesn't matter.


          I remember, that I recently got a MakeDxDataBook script from mentor, that uses automation for the first time. And this was very slow. With HKP, it is significant faster.


          There is IMHO nothing in your program, that can be made faster. The best recommendation is to use a faster drive (no network) or export HKP, as long as it is supported by Mentor.

          1 of 1 people found this helpful
          • 2. Re: Library automation performance problem



            Re speed of VBA: This would be the first VBA script that I know that beats a C# program. Would you mind sharing it or is it confidential?


            Re hkp: This program is part of our attempt to learn to live without hkp files. So far it doesn't look like we can. So we can only continue to try to pressure Mentor to keep some text file export, be it hkp, xml or something else.

            Re network drive: We maintain a large pool of workstations, unfortunately there's no way to take the library off the network drive.

            • 3. Re: Library automation performance problem

              There is nothing special in this VBA-programm. It travels through collection of partitions, parts and properties. Maybe, that the COM interface is a little bit faster than the .Net? I don't know.


              Just try the attached VBS-File. It runs in seconds, not minutes.


              And regarding netdrives and HKP: I'm full with you. You are not alone with your problems. I also hope, that Mentor will understand, why we need external tools. HKP or ASCII may be equal, but nearly each designer has written a couple of tools and don't want to rewrite everything. So it would be better to check the HKP input data instead of replacing the format.

              1 of 1 people found this helpful
              • 4. Re: Library automation performance problem



                After debugging for a while I found out what the problem was.

                .NET is per default multithreaded and with COM this causes synchronization overhead.

                The solution in this case is simply to apply the STAThread-Attribute to the main function and I get a speedup of factor 10 when working on a local drive. (When working on a network drive, the gain is dwarfed by the network delays, unfortunately.)

                Here's the new code. I also simplified it and changed it so that it produces the same output your script does.

                Since with out small library it takes only zero-point-something seconds, maybe you could run it on your library again and compare it to your script?


                Thanks a whole lot for your help!


                • 5. Re: Library automation performance problem

                  5 Seconds for 18300 parts. Great.

                  • 6. Re: Library automation performance problem

                    Over here, with the full output (i.e. the mappings) I save about 90s.

                    With the library on disk it's the difference between 2:50min and 1:20min, with the library on a network drive it's unfortunately the difference between 16:50min and ca. 15min. :-((

                    This, compared to the few seconds the library services take when saving a hkp from the network based library.

                    Well, one more argument to bring up when mentor tells us that we can do everything using automation.

                    Anyway, thanks a lot for helping me!