1
$\begingroup$

I have a code. After Quit, I want to re-evaluate the notebook. It takes about 10 seconds to start the re-evaluation in Windows 10.

But my friend uses Macbook. It takes about 1 second in MacOS.

How to decrease the time on my PC? What are your suggestions? (any suggestion, such as alternatives of Quit )

P.S. Although I use ClearAll["Global`*"] at the beginning, I don't sometimes get the correct results while re-evaluating. So, I need to Quit command to get the correct results.

$\endgroup$
9
  • $\begingroup$ I am seeing similar times on my machines. Unfortunately, I don't think there is too much you can do here. That being said, quitting the kernel is rarely required. Usually, you can just reevaluate the notebook, optionally with some Clear commands at the beginning. With this in mind, is there a particular reason why you are restarting the kernel so frequently that you are bothered by this time delay? $\endgroup$
    – Lukas Lang
    Commented Jun 18, 2021 at 13:55
  • 1
    $\begingroup$ Although I use ClearAll["Global`*"] at the beginning, I don't sometimes get the correct results while re-evaluating. So, I need to Quit command to get the correct results. $\endgroup$
    – 1_student
    Commented Jun 18, 2021 at 14:05
  • $\begingroup$ Are you using any other contexts apart from Global? $\endgroup$ Commented Jun 18, 2021 at 14:14
  • 2
    $\begingroup$ It might be a good idea to determine why you don't get the same result upon the second evaluation. It may expose a problem in your code. Doing this is usually not difficult: you simply need to evaluate inputs one-by-one (instead of en-masse), and find where the difference first appears. Then break down the offending input into smaller and smaller parts until you find the culprit. $\endgroup$
    – Szabolcs
    Commented Jun 18, 2021 at 14:20
  • 1
    $\begingroup$ What's in your init.m file (FindFile["init.m"])? You did say it takes 10 seconds before the notebook evaluation starts, right? $\endgroup$
    – Michael E2
    Commented Jun 18, 2021 at 19:20

1 Answer 1

1
$\begingroup$

Possible causes of slow kernel initiation that I have heard of are reading paclet info and slow FlexLM server/licencing.

You could try resetting Mathematica to see if that speeds up kernel initiation.

Resetting Mathematica’s preferences, caches and history

Are you using a network licence (FlexLM)?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.