Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try - catch bad for performance in Julia. #104

Open
AbelHutten opened this issue Oct 8, 2023 · 1 comment
Open

Try - catch bad for performance in Julia. #104

AbelHutten opened this issue Oct 8, 2023 · 1 comment

Comments

@AbelHutten
Copy link
Contributor

From the official Julia documentation, in the section on noteworthy differences between Julia and Python:

Exception handling in Julia is done using try — catch — finally, instead of try — except — finally. In contrast to Python, it is not recommended to use exception handling as part of the normal workflow in Julia (compared with Python, Julia is faster at ordinary control flow but slower at exception-catching).

Therefore, while it makes sense for SimPy to handle interruptions with try - except logic, doing so in ConcurrentSim hurts performance, and may not be the ideal solution.

@Krastanov
Copy link
Member

Indeed, let's mark this up as a feature and documentation request. There is an alternative to some of the try-catch uses (e.g. by relying on isready or waiting on events), but we can keep this issue open until all examples in the documentation use a non-exception control flow and that the performance issues of try-catch are also well documented in appropriate warning blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants