-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deprecate tic and toc #17046
Comments
-1 Deprecation of a warm welcome to matlab users? How about rather add a tip to
|
The macros can't replace
could be fixed though? |
PS: @nalimilan I don't think you meant
I agree that |
Another option will naturally be to override printing of |
@ivarne Sorry, I meant MatlabCompat.jl. |
Coming from Python, I love tic() and toc() a lot. Easy and intuitive! |
@ivarne: This is a very good suggestion, but could be applied to various other functions as well. Thus it might be good to provide a more general framework here, where a list of "common" functions from other languages is parsed. Personally, I would not see an urgent need to remove these two particular functions. But this is quite subjective of course. |
Oftentimes, in my MATLAB code, I use tic and toc to allow me to have the code output the time since a certain point in the code, in order to be able to easily keep track of run time mid-run. Sure, it can be done in julia using time() and storing the "tic" time and then subtracting it from the time where I want to "toc", but tic/toc makes it much cleaner. So rather than deprecating tic and toc, I'd actually like to see them extended slightly. Right now, you can only have one toc/toq per tic. It would be nice if you could reuse the existing tic until a new tic is set, perhaps with "tok()"? (for "toc keep", much as toq is "toc quiet") |
From triage: Let's deprecate these methods and put them into MatlabCompat for people who are used to them from MATLAB. They are unintuitive for people who don't know them and the fact that they have global state makes them pretty much useless anywhere but the REPL. |
Right – the global state is a disaster in combination with threading. |
just fwiw, they don't have global state, and have no issues at all being used with threading. |
Ah, it's task-local? |
Ah, yeah, that's true. The original implementation used a global array – I was thinking of that. |
I suggest that we should deprecate
tic
andtoc
and explain that@elapsed
or one of the@time
family should be used instead.The text was updated successfully, but these errors were encountered: