Giter Club home page Giter Club logo

Comments (4)

chtenb avatar chtenb commented on June 9, 2024 1

Done @modery

from graphviz.netwrapper.

chtenb avatar chtenb commented on June 9, 2024

Could this be specific to starting processes in a winforms application?
When I reproduce your code in a unit test it prints:

Starting: 1/19/2024 2:19:40 PM
Finished: 1/19/2024 2:19:43 PM

And after removing the redundant calls to CreateLayout:

Starting: 1/19/2024 2:20:19 PM
Finished: 1/19/2024 2:20:20 PM

I don't think we do anything exotic in this library, we just start a process and communicate over stdin/stdout. But since you mention you see a console window opening every call, there would likely be some additional overhead somewhere.

Sounds a bit like https://stackoverflow.com/questions/5377423/hide-console-window-from-process-start-c-sharp which recommends setting startInfo.UseShellExecute = false;, but we already do that. Perhaps you could experiment with other options, like ProcessWindowStyle.Hidden and see if that resolves your issue?

from graphviz.netwrapper.

modery avatar modery commented on June 9, 2024

I can confirm that running the same code in a console app takes 2 seconds (as expected).

Tested your suggestion, and added the Rubjerg.Graphviz and GraphvizWrapper projects to a test solution. Compiled as is (so same as 2.0.0), and the behaviour is the same (window pops up, generally it's slow).

Once I added the process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; to the relevant section in GraphvizCommand.Exec, the window didn't pop up again and generation was as fast as before

         // Redirect the input/output streams
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.RedirectStandardOutput = true;
        process.StartInfo.RedirectStandardInput = true;
        process.StartInfo.RedirectStandardError = true;
        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

Final test was doing the same thing in my actual program, and I can confirm that things worked well once the ProcessWindowStyle.Hidden was set

from graphviz.netwrapper.

modery avatar modery commented on June 9, 2024

Hi @chtenb , will you publish a new release for this? Preferably I wouldn't want to include your code in my own as a submodule, and rather simply use nuget (as I've been doing so far)

from graphviz.netwrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.