[kcalc] [Bug 448769] KCalc becomes unresponsive during computationally complex calculations

2023-09-25 Thread Gabriel Barrantes
https://bugs.kde.org/show_bug.cgi?id=448769

Gabriel Barrantes  changed:

   What|Removed |Added

 CC||gabriel.barrantes.dev@outlo
   ||ok.com

-- 
You are receiving this mail because:
You are watching all bug changes.

[kcalc] [Bug 448769] KCalc becomes unresponsive during computationally complex calculations

2022-01-19 Thread Evan Teran
https://bugs.kde.org/show_bug.cgi?id=448769

--- Comment #3 from Evan Teran  ---
Right. So addressing this "right" is suprisingly complex. Basically the issue
is that the code for doing arbitrary precision math has no "cancellation
points". The conventional solution to this kind of thing is to do the work in a
background thread, and have that thread periodically check "did the user
cancel"... But the library we use (GMP) just does the work, start to finish. It
doesn't ask the caller "should I continue?" at any point during a long
calculation. 

Killing a thread mid-process is considered so dangerous, that many OSes don't
even provide clean APIs to do it... 

The other solution, which GMP also doesn't offer, is to have the work done in
small bits you can call repeatedly until complete, allowing the caller an
oportunity to run the event loop themselves (and/or just stop calling the "do
some work" function if the user wishes to cancel). One can imagine the math
being done in a virtual machine of sorts where the caller can run as many or as
few instructions towards solving the problem at a time as they please.

Either way, Neither of these are really easily options for us.

So what's the solution? Well, probably to literally have the work done in a
seperate process which CAN be killed via a signal and communicate the results
with a pipe. It will be complicated to do this nicely, but it's doable and
would fully address this issue of long running calculations freezing the UI.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kcalc] [Bug 448769] KCalc becomes unresponsive during computationally complex calculations

2022-01-19 Thread Joe Cardenas
https://bugs.kde.org/show_bug.cgi?id=448769

Joe Cardenas  changed:

   What|Removed |Added

 CC||coderjo...@gmail.com
Version|unspecified |21.12.1
 Status|REPORTED|CONFIRMED
 Ever confirmed|0   |1

--- Comment #2 from Joe Cardenas  ---
Reproduced on 21.12.1 . I can also confirm that the UI regains responsiveness
when the operation completes.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kcalc] [Bug 448769] KCalc becomes unresponsive during computationally complex calculations

2022-01-19 Thread Niklas Freund
https://bugs.kde.org/show_bug.cgi?id=448769

--- Comment #1 from Niklas Freund  ---
To clarify, I may be exaggerating a bit on the runtime of that factorial there
(it may not be the lifetime of the universe, though it definitely takes an
hour), but the main point is that KCalc should have some way to abort a
calculation if it takes too long (instead of having to kill KCalc).

-- 
You are receiving this mail because:
You are watching all bug changes.