Skip to content

feat: op registration during calls - #3375

Merged
ry merged 3 commits into
denoland:masterfrom
afinch7:register_during_call
Nov 19, 2019
Merged

ry merged 3 commits into
denoland:masterfrom
afinch7:register_during_call

Conversation

@afinch7

@afinch7 afinch7 commented Nov 18, 2019

Copy link
Copy Markdown
Contributor

prerequisite for #3372

Comment thread core/isolate.rs Outdated
Comment thread core/Cargo.toml Outdated
Comment thread core/ops.rs
dispatchers: Vec<Box<OpDispatcher>>,
name_to_id: HashMap<String, OpId>,
dispatchers: RwLock<Vec<Arc<Box<OpDispatcher>>>>,
name_to_id: RwLock<HashMap<String, OpId>>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭 this might impact performance, hot path will require to acquire a read lock everytime

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like it did in benchmarks.

@bartlomieju bartlomieju Nov 18, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but they're flaky... Anyway why do you need to put dispatchers behind the lock? In native plugin PR you already have Arc<Mutex<Isolate>> available so you should be able to register new ops quite easily

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases during dispatch we already have a lock on isolate somewhere else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... I'm curious to see it combined with native plugins PR

@ry ry left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I'm worried about the locks too, but I think we need this functionality. Let's keep an eye on the benchmarks after this and see if there are any noticeable regressions.

( and this nice work @afinch7 )

@ry
ry merged commit b6b813c into denoland:master Nov 19, 2019
@afinch7

afinch7 commented Nov 19, 2019

Copy link
Copy Markdown
Contributor Author

It doesn't look like it messed with the benchmarks much at all. I think it would take something pretty drastic on the rust side to really be noticeable beyond max latency.

bartlomieju pushed a commit to bartlomieju/deno that referenced this pull request Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants