Comments (5)
Why not setting the allocation functions using the same utilities of libuv
? Is there any problem with it?
from uvw.
oh am I misunderstood something?
below codes are something I tracked.
template<typename T, typename U>
class StreamHandle: public Handle<T, U> {
void read() {
this->invoke(&uv_read_start, this->template get<uv_stream_t>(), &this->allocCallback, &readCallback);
}
}
template<typename T, typename U>
class Handle: public Resource<T, U> {
static void allocCallback(uv_handle_t *, std::size_t suggested, uv_buf_t *buf) {
auto size = static_cast<unsigned int>(suggested);
*buf = uv_buf_init(new char[size], size);
}
}
I thought that problem rise this line of code
*buf = uv_buf_init(new char[size], size);
I'd like to pass pre-allocated buffer that I'm gonna re-use over and over.
In that way I understand that there should be a way that I can pass my pre-allocated buffer to uv_buf.base.
Is there are something that I misunderstood or miss some of functionality in libuv or uvw?
from uvw.
Hi, sorry for the late reply, I'm on vacation and also trying to have a real break from my dev life.
I see what you mean. Consider that we're about to merge branch v3
that is a HUGE change to the library, both in terms of performance and compilation time.
Can we consider this as a feature request to add allocator support to that version? It seems to me the only viable solution. Any other idea?
from uvw.
+1 for the ability to inject a custom buffer allocation callback.
First of all new
is a lot of overhead compared to reusing buffers from an allocation pool. Also it looks like your current implementation effectively prevents recvmmsg()
for UDP, which is the use case I'm evaluating now. The suggested
buffer size is given as max UDP datagram size, but libuv requires a multiple of that for recvmmsg()
. Rather crude implementation from libuv side too, but that's what it is now.
from uvw.
Related Issues (20)
- CMake package configuration files for uvw HOT 4
- ctest error : uvw_util faild HOT 1
- Update uvw to libuv 1.42.0 HOT 1
- If send UDP as async, does the uvw will queue message automatically? HOT 2
- Failures in unit tests on some platforms HOT 5
- Does uvw is thread-safe? HOT 4
- How to handle the data if send fails. HOT 12
- How to retrieve ErrorEvent info? HOT 1
- How to handle an existing UNIX socket? HOT 4
- Update to libuv v1.43 HOT 2
- Non-UTF-8 characters in type_info.hpp HOT 2
- documentation license is vague HOT 4
- type_info always returning same value HOT 3
- UDP send after connect not possible HOT 1
- Capturing SIGINT HOT 8
- The library targets are not versioned. HOT 7
- Failing workflows as github changed several compilers from ubuntu machines. HOT 6
- Cannot get access to online document HOT 1
- ErrorCode EPIPE -4047 Broken Pipe HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uvw.