Comments (2)
Looks broadly fine. I'd probably try to avoid dealing in lengths all the time, because in some edge cases this can cause catastrophic performance (usually when dealing with massively recursive models) - if you can deal in positions rather than lengths it may work better, but: in most cases (the ones not I volving massively recursive models) it won't matter. I can't see the parser code - note that for optimal performance you want to use a ref-counting "buffer reader" that tracks a span, rather than constantly accessing spans from the buffer. SE.Redis and protobuf-net both have examples of this that you may find useful.
from pipelines.sockets.unofficial.
Ok, thanks, that's good. I was worried about the looping with tasks. I'd normally approach this with a dedicated thread and events but that doesn't scale.
The parser implementation contains protocol details which are proprietary so I can't post that unfortunately. The protocol is pretty simple flat utf8 encoded with no nesting. The parser takes the sequence and attempts to pull apart each slice, I can show that part, I grab each segment span and attempt to consume it as far as possible skipping any known prefix so I avoid re-running a complex parse if possible.
I'm not sure what you mean with the lengths. The Message object returned by the parser will always start at offset 0 so length is both a length and a relative position, Which part would you change and what approach would be better?
I'll find and take a look at the SE.Redis code, that's probably closest to what I'm doing.
from pipelines.sockets.unofficial.
Related Issues (20)
- High CPU due to lock contention on _queue in DedicatedThreadPoolPipeScheduler.Schedule HOT 6
- Xamarin.Android crash with native exception on SocketConnection.Create HOT 2
- TLS/SSL support HOT 6
- How to find out when/if the reader/writer completed HOT 3
- Does this project only support .Net Core, instead of .Net Framework? HOT 8
- if the implementation of this library has relation ship for Rio(Winsock registered I/O extensions) in Windows? HOT 2
- Unable to wait for socket closure HOT 2
- Test: MutexSlim_ConcurrentLoadAsync_DisableContext - fails on my machine
- Test: ConnectTests.Connect - Fails on my machine HOT 1
- Test: BufferWriterDoesNotLeak also fails on my machine
- Set unsafeSuppressExecutionContextFlow on SocketAsyncEventArgs HOT 3
- Loopback fast path is deprected on Windows and can cause high cpu on Win Server 2019 HOT 2
- How do I flush synchronously? HOT 5
- Pump a pair of PipeReader/PipeWriter
- Investigating SemaphoreSlim on net6.0+ HOT 1
- Unnecessary _queue.Count check in DedicatedThreadPoolPipeScheduler.RunWorkLoop HOT 7
- netstandard2.1 DoReceive fails on Zero Length Reads on Mono HOT 1
- Thread Safety Violation Warnings found by InferSharp static analysis tool HOT 3
- Trim and AOT warnings in Delegates and PerTypeHelpers HOT 3
- Fix Thread Safety and other static code analysis issues reported by Infer#
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 pipelines.sockets.unofficial.