View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017931 | Scribus | Scripter | public | 2026-08-19 15:47 | 2026-08-29 17:11 |
| Reporter | flagsoft | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | new | Resolution | open | ||
| Product Version | 1.7.4.svn | ||||
| Summary | 0017931: Scribus Python scripts run 2 times slower every time if called again | ||||
| Description | It doubles the time to execute every time you run a Scribus Python script again. | ||||
| Steps To Reproduce | 1. Start Scribus 2. Run your Python Script 3. Run your Python Script again (about 2 times slower then before 2.!) 4. Run your Python Script again (about 2 times slower then before 3.!) etc. It doubles the time to execute every time you run a Scribus Python script again. Tested with 1.6.6 (Download, stable) 1.6.7.svn (compiled) 1.7.4.svn (compiled) Always the same behaviour. So before optimizing your script for speed, just re-start Scribus again... but this is no solution. Wonder what this is, or is there a "reset" python Script that we can / should call at the beginning of any Script? | ||||
| Tags | undo | ||||
| Patch | No | ||||
|
|
Can you please provide a script that has some timing measurement and can be used to replicate the issue? |
|
|
## 2026-08aug-19
## twice-as-slow-every-time.py
## Scribus 1.6.6 script
##
import sys
import gc
## -- for debug time
import time
from datetime import datetime
try:
import scribus
except ImportError:
print('This script must be run from inside Scribus')
sys.exit()
def main():
now = datetime.now()
print("- BEGIN:", now.strftime("%Y-%m-%d %H:%M:%S") )
DEBUG_start = time.time()
scribus.setRedraw(False)
## -- remove textframe if they exist
for tmp_num in range(1, 20):
if scribus.objectExists('_textframe_'+str(tmp_num)):
scribus.deleteObject('_textframe_'+str(tmp_num))
print("- removed existing textframe number:", tmp_num)
## -- create textframe
for y in range(1, 20):
offset_y = y*10;
scribus.createText(20, 4 + offset_y, 90, 6, '_textframe_'+str(y))
scribus.setText('Text'+str(y), '_textframe_'+str(y))
#scribus.insertText(str(y), -1)
#print(y)
scribus.setRedraw(True)
now2 = datetime.now()
print("- END:", now2.strftime("%Y-%m-%d %H:%M:%S") )
DEBUG_end = time.time()
print("- Execution time [seconds]: ", DEBUG_end - DEBUG_start)
if __name__ == "__main__":
main()
## Explicitly force Python garbage collection at the end of the run
gc.collect() ## does not help, scrpit slows down two times every tine it gets called again
|
|
|
Has anyone tested this? What can we do about it? Seems to be a problem on all versions of Scribus. |
|
|
I've now tried it out. And I've found out will surprise you. At first, yes, I can replicate. But then, OK, it's deleting and adding again the same frame. And the execution time somehow grows. It does not really double, but it grows noticeably. What about undoing before the next run? Oh, yes, now it's faster again. Not as fast as the beginning, but faster again. Then slower again. Oh, and if it is the undo that gets slower and slower? In the Document Setup I've turned off the undo and: the time does not grow anymore. Questions:
|
|
|
Thanks for testing. And, yes, it is in deed the UNDO system. But I think it's implemented the wrong way, maybe? It can't be that slow. If Scribus fix this, it will be a huge update in performance for the end user. If there is a Scribus Python function to temporary disable and enable UNDO it would be great. Something like that: - scribus.useUndo(False) - scribus.useUndo(True) - scribus.useUndo(4) Of, as it's per document: - scribus.documentUndo(False) - scribus.documentUndo(True) - scribus.documentUndo(4) |
|
|
indeed - can one edit posts here? |
|
|
I've looked at this over the last week on and off. I have committed a couple of changes but mostly fixes and not things that will speed this up unfortunately. |
|
|
Can we have at least the Python functions to disable/enable Undo? f there is a Scribus Python function to temporary disable and enable UNDO it would be great. Something like that: - scribus.useUndo(False) - scribus.useUndo(True) - scribus.useUndo(4) Of, as it's per document: - scribus.documentUndo(False) - scribus.documentUndo(True) - scribus.documentUndo(4) |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-08-19 15:47 | flagsoft | New Issue | |
| 2026-08-19 15:58 | ale | Note Added: 0054232 | |
| 2026-08-19 18:25 | flagsoft | Note Added: 0054236 | |
| 2026-08-23 14:11 | flagsoft | Note Added: 0054293 | |
| 2026-08-25 19:55 | jghali | Priority | high => normal |
| 2026-08-26 18:37 | ale | Note Edited: 0054236 | |
| 2026-08-26 19:07 | ale | Note Added: 0054310 | |
| 2026-08-26 19:08 | ale | Tag Attached: undo | |
| 2026-08-27 17:40 | flagsoft | Note Added: 0054346 | |
| 2026-08-27 17:41 | flagsoft | Note Added: 0054347 | |
| 2026-08-27 20:42 | cbradney | Note Added: 0054348 | |
| 2026-08-29 17:11 | flagsoft | Note Added: 0054374 |