Author Topic: [PJSR] TextBox very slow  (Read 4719 times)

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
[PJSR] TextBox very slow
« on: 2012 September 11 12:52:37 »
Hello,
When I update a text in a text box (just replacing the text of about 100 lines by a new one in a string, no formatting), it takes almost 1 second (measuring the time around setting the 'text' property, without the refresh).  For comparison, the JS code that does regexp and many string manipulations per line and update a few other controls takes just 2 ms for the same data.
The TreeBox is much faster, in spite of having a few columns etc....
Anything I missed?
-- bitli


Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: [PJSR] TextBox very slow
« Reply #1 on: 2012 September 11 23:47:33 »
I found a workaround.  I use a TreeBox with a single colon, no header, I format the text in lines and create one TreeNode for each line (I do not need the Edit functionality, it is just showing text).
The update is instantaneous, at least for 100 lines.
-- bitli

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: [PJSR] TextBox very slow
« Reply #2 on: 2012 September 12 01:01:02 »
This is very strange. I have never seen anything similar. Could you post the source code you're using to write to the TextBox?
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline bitli

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 513
Re: [PJSR] TextBox very slow
« Reply #3 on: 2012 September 12 08:51:21 »
Here it is.
You start the script and select a directory with a bunch of fits files (say 50 to 200), nothing will be done to the file if you do not press Move or Copy...
Add some characters at the end of the field 'Target file template' - the log will indicate the timing during the refresh, that happens while you type (and you will see the delay).
Uncomment // #define USE_TREEBOX at line 73 and redo the same.
The response will be almost instantaneous.
The relevant code is at line 2266, it is pretty short.
The  file is the combined script - I have also made it public at https://bitbucket.org/bitli/fitsfilemanager.

This is not critical, the workaround works fine (in fact it is even a better solution, much easier to mark lines in error)

-- bitli