Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2151

PB is very Slow when manipulate large strings

$
0
0

Hi to all,

 

i have a little code that, in a loop (1000 times) create a string concatenating some data.

 

This is very very very  slow compared to write the same data to a file.

 

i'm wonder of this.

 

If you want do a test, this is the code:

 

string ls_dummy,ls_dummy2

string ls_start,ls_start_2

string ls_stop,ls_stop_2

long ll_k

long ll_file

 

ls_dummy= 'test_string_of_a_certain_lenght_non_very_small_bla_bla_bla_bla_etc_etc_etc_ect_sbut_not so hightest_string_of_a_certain_lenght_non_very_small_bla_bla_bla_bla_etc_etc_etc_ect_sbut_not so high'

 

ls_start = string(Cpu ( ) )

ll_file = FileOpen("c:\temp\test.xml",lineMode!, Write!, LockWrite!, Replace!)

for ll_k =1 to 10000

    FILEWRITEEX(ll_file,ls_dummy)

next

fileclose(ll_file)

ls_stop =  string(Cpu ( ))

 

 

ls_start_2 = string(Cpu ( ))

for ll_k =1 to 10000

    ls_dummy2 = ls_dummy2 + ls_dummy

next

ls_stop_2 =  string(Cpu ( ))

 

messagebox('time1:= '+ls_start+' - ' +ls_stop, 'time2_= '+ ls_start_2+ ' - ' +ls_stop_2)

 

//and this is the result on my pc:

Senza nome.png

In yours opinion is normal that "in memory operations" are slower  than "on disk operations"?

 

i'm wrong something?


Viewing all articles
Browse latest Browse all 2151

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>