Giter VIP home page Giter VIP logo

Comments (11)

9swampy avatar 9swampy commented on June 12, 2024

Yes, of course it could be improved; can't everything? I'm glad it works; sorry about the high CPU usage. The sledgehammer that the existing implementation makes available you've already identified is the spinwait delay which in some places can be optionally passed in. If the entry points aren't sufficient for your needs you're welcome to branch, extend and submit a pull request and so long as you don't break anything incumbent I'll merge it in. Even if it does break something I'll consider it but it might take longer to complete the merge :)

from telnet.

iftahb avatar iftahb commented on June 12, 2024

from telnet.

9swampy avatar 9swampy commented on June 12, 2024

Pros; simplicity and cross framework/platform reusability
Cons; it's all still pretty synchronous atm despite the half way house async spin stuff which was enough to facilitate keeping a simple UI responsive, per my use cases; but is going to come to it's knees before long if you start running multiple parallel threads per your use case... Delay and sleep are little better than each other; looking in to the event model and using callbacks to respond to activity is probably a good route to pursue; but that is likely to quickly break across the frameworks and certainly wouldn't be a trivial pursuit.

from telnet.

iftahb avatar iftahb commented on June 12, 2024

Thanks, but not sure I understand your first reply.
Is there a configurable "sleep/delay" setting I could use to lower the CPU load (and pay with responsiveness, as I am not using a UI and therefore less sensitive) without changing the code?

from telnet.

9swampy avatar 9swampy commented on June 12, 2024

Sorry for misleading, you're right. I checked out the code while merging in the LineTerminator PR and seems like you would need a code change to alter the DefaultTimeoutMs (depending on framework version you're using). Wouldn't be too hard to add in an overload or two (or more for others with same problem :) and would definitely be a step in the right direction even if it would still be a bit of a sledgehammer...

from telnet.

iftahb avatar iftahb commented on June 12, 2024

from telnet.

9swampy avatar 9swampy commented on June 12, 2024

from telnet.

A9G-Data-Droid avatar A9G-Data-Droid commented on June 12, 2024

In my latest Pull Request #35 I increased the delay between reads from 1ms to 16ms. I did this because most operating systems do not measure ticks below 10ms which can cause sleep times of 1ms to be treated as zero. That seems to help on receiving packets but the largest performance boost I was able to produce was from buffering writes and changing all internal write operations from .WriteByte to .WriteAsync. This vastly reduced TCP overhead.

Read about double buffered TCP writes here:
http://www.stuartcheshire.org/papers/nagledelayedack/

If you would like to beta test my new version you can get it here:
https://github.com/A9G-Data-Droid/Telnet/releases/tag/0.8.2

from telnet.

iftahb avatar iftahb commented on June 12, 2024

from telnet.

9swampy avatar 9swampy commented on June 12, 2024

@iftahb @A9G-Data-Droid guys; sorry had to come on and reply that I likewise appreciate all done; but I've got a day job & life too and the amount of effort that's gone in to all the improvements suggested is going to take time to review, build and publish which I've not had in the last few days; sorry. Bear with me please... In the meantime feedback on the beta release would be most helpful to both of us :)

from telnet.

A9G-Data-Droid avatar A9G-Data-Droid commented on June 12, 2024

@iftahb I'm not sure. My code doesn't connect to more than one host at a time but I hope you see a performance boost from my improvements. Please let me know if it helps.

from telnet.

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.