Giter Club home page Giter Club logo

Comments (7)

jwakely avatar jwakely commented on July 30, 2024

We can consider whether we want it to be a customization point, but it currently isn't one. Paragraph 2 of Clause 4 [namespaces] means that references to buffer_size in the TS mean std::experimental::networking::v1::buffer_size, so program-defined overloads wouldn't be found by ADL.

N.B. if we want basic_streambuf to be usable as a buffer then we would need to provide a suitable overload ourselves in the TS, as it is undefined for the program to add an overload to namespace std.

from networking-ts.

vinniefalco avatar vinniefalco commented on July 30, 2024

N.B. if we want basic_streambuf to be usable as a buffer

Let me clarify. Types meeting the requirements of DynamicBuffer, such as basic_streambuf, define the "input area" and the "output area" which are themselves buffer sequences. So, the dynamic buffer is not the buffer sequence but rather, the two objects it provides. They are defined by the nested types const_buffers_type and mutable_buffers_type. For example:
https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/basic_streambuf.hpp#L122

I'm weakly in favor of having buffer_size as a customization point, since buffer_size for a beast::basic_streambuf::const_buffers_type or beast::basic_streambuf::mutable_buffers_type will have an execution time of O(N) where N is the number of buffers in its list:
https://github.com/vinniefalco/Beast/blob/master/include/beast/core/basic_streambuf.hpp#L74

With a customization point it could run in O(1):
https://github.com/vinniefalco/Beast/blob/master/include/beast/core/basic_streambuf.hpp#L242

Example implementation

template<class Allocator>
std::size_t
buffer_size(basic_streambuf<Allocator>::const_buffers_type const& cb)
{
    return cb.sb_->size();
}

On the other hand, I realize that I'm bringing this up rather late in the game and I don't want to create a bunch of unnecessary work for anyone. What are your thoughts?

from networking-ts.

vinniefalco avatar vinniefalco commented on July 30, 2024

Good talk :)

from networking-ts.

jwakely avatar jwakely commented on July 30, 2024

This will be submitted as a national body comment on the PDTS. I don't have a personal opinion on this topic and Github issues are not the right place to do design work, that needs to happen elsewhere and then be approved by the C++ committee.

from networking-ts.

jwakely avatar jwakely commented on July 30, 2024

This was submitted as a National Body comment against the PDTS, and discussed by the Library Evolution Working Group, see https://issues.isocpp.org/show_bug.cgi?id=300

from networking-ts.

vinniefalco avatar vinniefalco commented on July 30, 2024

This has become a performance issue for a company, I would like to revisit this - what is the procedure for doing so?

from networking-ts.

jwakely avatar jwakely commented on July 30, 2024

Via the WG21 committee. The recommended response to the NB comment is not to make a change at this time (i.e. for v1 of the TS). If you want to persuade them otherwise you need to talk to the committee (and I won't be present at the next meeting to do so on your behalf).

from networking-ts.

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.