Delphi-Cross-Socket
Delphi-Cross-Socket copied to clipboard
epoll rewrite
hello,
imho your code is well written, especially the IOCOMP windows code, however let me express doubts about the scalability and reliability of EPOLL linux wrapper, using a single thread with global locking queue, you should avoid this
best regards Roberto
another hint I see you use extensively TList and .ToArray method, then using a for iteration for lookup, as example I see this in WebsocketServer (O2 complexity) you should avoid global locking as TMonitor if possible, make use of TCriticalSection, but I suggest to make a right use of generic.collections as TDictionary<Type> to obtain O1 lookup time; this will be useful with high number of users
also consider that a static class function is very faster against a interfaces one
(...) or you can bind directly the callback within every connection (instead of interface), then avoid/erase to iterate an array obtained from a global list everytime a message is received (guess a chat with thousand users...). So use a direct pointer, or a dictionary if you want keep a global list with interfaces.
Thank you very much for your suggestion, perhaps you can help me improve the code, then do a comparison test, thank you again.
Thank you for this great library. Now I don't have time to modify it, later I can try to provide some changes, then we can use a profiler to check the timing of the routines (maybe using SleuthQA of Per Larsen, now sold by Nexus Quality Suite). Anyway the most important thing you can do is avoid to use iteration/copy of lists on the common used functions, instead use a lookup as tdictionary (hash table) or avoid it completely, redesign the flow (eg. put the function/callback/smart pointer inside every class avoiding the use of a global container). See you soon I wish. Best regards.
估计这老兄看上你的项目了,可能要找你合作!
another hint: use const keyword when you pass the parameter in a function const don't copy the string, or use var if you need manage it and return it I suggest use TBytes and setlength one shot, then use TEncoding.ASCII.GetBytes etc. avoid copymem most possible use scatter/gather buffering zerocopy methods avoid global locking semaphores, use interlocked API ...
hi Roberto
It is recommended that you modify part of the code on the branch for reference!
hello,
imho your code is well written, especially the IOCOMP windows code, however let me express doubts about the scalability and reliability of EPOLL linux wrapper, using a single thread with global locking queue, you should avoid this
best regards Roberto
Can you point out the problem code, modify some of the code, and test the effect!