Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
What does the comment |
BetaWas this translation helpful?Give feedback.
All reactions
This means that, if someone was porting to a language supporting multiple threads (e.g., C), then porting as is would not be thread safe. In JavaScript, we can elevate memory allocations out of functions as code does not need be reentrant. In C, we would not be able to do so.
Replies: 1 comment 3 replies
-
This means that, if someone was porting to a language supporting multiple threads (e.g., C), then porting as is would not be thread safe. In JavaScript, we can elevate memory allocations out of functions as code does not need be reentrant. In C, we would not be able to do so. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
If you fork a C program, then both programs have their own copy of the in-scope variables right? Wouldn't it still be thread safe then? But in any case, I think the comments aren't needed. Someone porting to any other language should know what they're doing in their target language. I believe the comments will cause more confusion there than benefit. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Re: fork. Yes, that is correct. The source comments are useful for us--that's why they are there--serving as a reminder as to how our internal native C and JS implementations should differ. |
BetaWas this translation helpful?Give feedback.
All reactions
-
New discovery today: JavaScript code which isnot thread safe can affect whether V8 is able to perform certain optimizations. If a function is not thread safe, this can trigger de-optimizations. This was discovered on newer versions of V8 during profiling. |
BetaWas this translation helpful?Give feedback.