Git Product home page Git Product logo

Comments (3)

apolukhin avatar apolukhin commented on May 21, 2024

Checking for deadline is not very cheap. Checking it before each socket operation could degrade performance quite a lot.

Are you describing a theoretical problem or the current behavior does harm in some practical case?

from userver.

itrofimow avatar itrofimow commented on May 21, 2024

or the current behavior does harm in some practical case?

Well, depends on what one would consider 'harmful', but i would argue that the current behavior it not consistent with other parts of the framework: i as developer strongly expect a function that takes deadline as a parameter to be a 'deadline-point', which takes the burden of checking a deadline from me.

Are you describing a theoretical problem ...

Mostly, but i remember being surprised by this when testing clickhouse driver.


Say you have following logic (in pseudocode):

void SendUntilDeadline(deadline) {
    while (true) {
        some_data = GenerateSomeData();
        socket.SendSome(some_data, deadline);
    }
}

One could assume that this function stops execution when deadline is reached, but it might go well beyond if receiving side can keep up


I understand that checking deadline before each socket operation is costly, but what's your opinion on checking deadline once as early as possible, before going into while (io_func) loop?

from userver.

itrofimow avatar itrofimow commented on May 21, 2024

@apolukhin bump

from userver.

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.