forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Loadfile in Table .... very very slow
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Cipper
Newbie


Joined: 21 Jun 2001
Posts: 22
Location: Trieste Italy

PostPosted: Wed Mar 23, 2005 8:33 am    Post subject: Loadfile in Table .... very very slow Reply with quote

Why If I load in table is very very slow (3000 record)

list loadfile,table1,@path(%0)ARCHIVIO.TXT

If I load in list is quickly ?

list loadfile,list1,@path(%0)ARCHIVIO.TXT

Can i resolve ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 8:51 am    Post subject: Reply with quote

No. It's fast to load a text file into a list because it has no structure, the loader just has to search for the line breaks. When loading into a table, each line has to be parsed into columns and a separate cell (kind of like in a spreadsheet) has to be created for each piece of data. So a lot more work is going on, and that's why it's slower.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Cipper
Newbie


Joined: 21 Jun 2001
Posts: 22
Location: Trieste Italy

PostPosted: Wed Mar 23, 2005 8:54 am    Post subject: Reply with quote

Ok, I have supposed, But there is a trick?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Mar 23, 2005 11:27 am    Post subject: Reply with quote

jules wrote:
No. It's fast to load a text file into a list ....


That certainly depends on the size of the text file, fairly large files take ages to load into VDS lists.
This was one of my main incentives for adding file operations to String.DLL

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 12:55 pm    Post subject: Reply with quote

But he's talking about the speed relative to a table. A 3000 line file should load quick enough.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Cipper
Newbie


Joined: 21 Jun 2001
Posts: 22
Location: Trieste Italy

PostPosted: Wed Mar 23, 2005 2:29 pm    Post subject: Reply with quote

650 lines come loaded in 12 seconds, are however a lot for who waits for.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Wed Mar 23, 2005 2:45 pm    Post subject: Reply with quote

Quote:
That certainly depends on the size of the text file, fairly large files take ages to load into VDS lists.
This was one of my main incentives for adding file operations to String.DLL


Hi Dread,

Utilizing your string.dll, is there a way to save a string directly to a file without having to insert it into a list first? If not, then could this be implemented?

Thanks,

- Boo
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 2:49 pm    Post subject: Reply with quote

Boo wrote:
Utilizing your string.dll, is there a way to save a string directly to a file without having to insert it into a list first? If not, then could this be implemented?


You could do that directly using BINFILE WRITE, TEXT.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Wed Mar 23, 2005 2:53 pm    Post subject: Reply with quote

But will it work quickly with very large files? Seems to me there was an issue with files several MB in size (even when increasing the buffer)?
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 2:57 pm    Post subject: Reply with quote

Cipper wrote:
650 lines come loaded in 12 seconds, are however a lot for who waits for.


If that's loading into a list, you must have a very slow computer. If it's into a table, that's just the way it is. If it were possible to do it quicker, it would have been made quicker in the first place.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 3:08 pm    Post subject: Reply with quote

Boo wrote:
But will it work quickly with very large files? Seems to me there was an issue with files several MB in size (even when increasing the buffer)?


You have a string several MB in size? Surprised

If you have a string that big, then you will have problems because of memory management issues. VDS 6 will probably be quicker, because it has a better memory manager.

But VDS is really not designed for handling large amounts of data. By its nature of the interpreter being a substitution engine, the contents of every variable get inserted into every command line. That means that if you have a huge string, it gets copied into the command line of every command that wants to do something with it. This is not very efficient and probably means that there are multiple copies in memory of your very large string at some points in time.

If you were using Pascal or C++ or something, you would probably keep the data in one place and just use a pointer to it. But VDS doesn't support pointers because it's meant to be a simple language that's easy to understand.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Wed Mar 23, 2005 3:15 pm    Post subject: Reply with quote

Hi Jules,

I've successfully used a string that's approximately 1.2 MB in size without problems. However, I used the vdsug.dll to write the string to a file. (And it writes FAST.) Wink

Thanks,

- Boo
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 3:37 pm    Post subject: Reply with quote

Well in that case I would have thought BINFILE WRITE would be just as quick. I would have thought the memory management of handling the large string was more responsible for the speed than the actual writing to disk. If anything, I would have expected it to be slower passing the data to an external DLL than to an internal command.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Mar 23, 2005 3:45 pm    Post subject: Reply with quote

You can do one of two things. First would be to simply hide the table
element while loading it. Second would be to use the @sendmsg()
to stop drawing the element until it's done loading and then send the
message to allow drawing after it's loaded. Either of these will increase
the speed.

Code:
WM_SETREDRAW

Value   Meaning
0   The redraw flag is cleared
1   The redraw flag is set

Sample Source Code


title TEST
   DIALOG CREATE,TEST,-1,0,214,224
   DIALOG ADD,BUTTON,BUTTON1,178,64,,,,DEFAULT
   DIALOG ADD,LIST,LIST1,8,12
   DIALOG SHOW
:evloop
   wait event
   goto @event()
:BUTTON1BUTTON
   %A = @sendmsg(@winexists(~LIST1),$0B,0,0)
   warn %A
   rem Above command set redraw flag to clear so list
   rem items can be added invisibly
   list add,list1,vds is cool
   list add,list1,my scripts always work
   list add,list1,this is basically
   list add,list1,adding in items to the
   list add,list1,list invisibly
   wait
   %A = @sendmsg(@winexists(~LIST1),$0B,1,0)
   rem Above command sets redraw flag to redraw thus
   rem showing all the list items.
   rem Allows items to be added into the list invisbly
   goto evloop
:CLOSE
   exit


%A = @sendmsg(@winexists(~LIST1),$0B,0,0) tells the element to
stop it's redraw while changes are being made.

%A = @sendmsg(@winexists(~LIST1),$0B,1,0) tells the element that
it's ok to redraw any changes made in the element now.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 23, 2005 4:26 pm    Post subject: Reply with quote

Nice tip, Garrett. It works with TABLE elements too. Unfortunately when I tried it, it didn't actually make the process any quicker (populating a table) and not seeing anything happening I found more disconcerting than looking at an egg timer for a few seconds.

I didn't try loading a TABLE from a file. Usually with a TABLE element you want to specify a bitmap for each line, and that means adding the data line by line. Even so, I can add about 1,000 items to a table, including determining the icon for each one, and then sort the table, in about 6 seconds, which I don't think is unacceptable.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group