jeudi 2 décembre 2021

Is asyncronously awaiting a method or subscribing to an event invoked from an async method more efficient (Intermediate Language/Backend Differences) [closed]

First off, context:

I am creating a custom DB using Memory Mapped Files. (Quickly I would like to say to the critic to that statement alone; I am not working on this for anyone but more as, we can just say, a learning experience. I'm having great fun, and learning a lot about lower level memory management and much more already!)

Okay, with that out of the way, my question regards a rather simple concept. Although I am guessing it may boil down to preference. My two primary areas of concern for my design are maximum performance, and security from unauthorized libraries.

With this said, my question is [theTitle][theFormerStatement]:

What are any considerable differences regarding primarily, though not limited to, abstraction, security, modularity, but especially performance. Of course IO is slow, this would be why I'm trying to start my design from the most performance efficient design pattern.

Also, I'm not asking about DB design choices or anything, I've found plenty on that subject, but rather, I am asking specifically about abstract system design options.

For further context to the IL part, I am using C#, but I'm assuming most languages use similar approaches on events and the like. What are the common advantages and disadvantages between builder pattern and event driven patterns, As it pertains to CIL or any similar IL

Update

I am looking for anyone who more thoroughly knows the low level impacts of these design options, if any, even provided otherwise identical data design choices.

For a generic example, if I wanted to write 1000bytes to the filesystem, I would need to, lets say, validate the file exists, if not create it, find the offset to write at, write the bytes, repeat for index file, validate the write by running a test query and comparing to data that was sent by a client (maybe not necessary, but I'm just coming up with fluff example of work to be done), then return the (bool success, int entryIdx).

(Builder) Call a the DB class by its chain of methods and async wait for result. OR

(Event) Subscribe to OnInsert event from DB and then call DB Write method.

it seems that the former would result in constant checks every frame for when the result returns, whereas the event, being a bit more detached by design, would allow the client to do whatever other work until the event fires, and catches the client system's attention to respond to the work.

What is the functional and performance differences in the IL behind awaiting work in a non-server app from client method call, and notifying any event subscribers vs awaiting results from a client app method call.

Aucun commentaire:

Enregistrer un commentaire