Closed brandy125 closed 2 years ago
Eeeh, not exactly 'Byte' in itself:
GDL> b=0 & a=1 & tic & for i=0l,10000 do c=byte(b) & toc
% Time elapsed : 0.0037691593 seconds.
IDL> b=0 & a=1 & tic & for i=0l,10000 do c=byte(b) & toc
% Time elapsed: 0.0025041103 seconds.
string-to-byte conversion is apparently 10 times slower:
GDL> b='toto' & tic & for i=0l,10000 do c=byte(b) & toc
% Time elapsed : 0.039747000 seconds.
IDL> b='toto' & tic & for i=0l,10000 do c=byte(b) & toc
% Time elapsed: 0.0038950443 seconds.
string 'addition' apparently also:
GDL> b='toto' & a='tutu' & tic & for i=0l,30000 do c=a+b & toc
% Time elapsed : 0.063489914 seconds.
IDL> b='toto' & a='tutu' & tic & for i=0l,30000 do c=a+b & toc
% Time elapsed: 0.010015011 seconds.
But in fact, doing nothing special is also slow:
GDL> b='toto' & a='tutu' & tic & for i=0l,30000 do wait,0 & toc
% Time elapsed : 0.054697037 seconds.
IDL> b='toto' & a='tutu' & tic & for i=0l,30000 do wait,0 & toc
% Time elapsed: 0.0017919540 seconds.
The real time spent in 'byte' is when you remove the time in doing nothing else than a loop, i.e., 0.063489914 -054697037 = 0.008. Loops are already discouraged in IDL in favor of vectorization, in GDL it is at the moment 10+ times worse! This probably because of the creation/destruction of objects inherent(?) of the C++ programming. Obviously there must be a way to improve this situation, help from C++ gurus will be needed though.
Thank you for your analysis!
On 24 Sep 2021, at 07:20, Giloo @.***> wrote:
Eeeh, not exactly 'Byte' in itself:
GDL> b=0 & a=1 & tic & for i=0l,10000 do c=byte(b) & toc % Time elapsed : 0.0037691593 seconds. IDL> b=0 & a=1 & tic & for i=0l,10000 do c=byte(b) & toc % Time elapsed: 0.0025041103 seconds. string-to-byte conversion is apparently 10 times slower:
GDL> b='toto' & tic & for i=0l,10000 do c=byte(b) & toc % Time elapsed : 0.039747000 seconds. IDL> b='toto' & tic & for i=0l,10000 do c=byte(b) & toc % Time elapsed: 0.0038950443 seconds. string 'addition' apparently also:
GDL> b='toto' & a='tutu' & tic & for i=0l,30000 do c=a+b & toc % Time elapsed : 0.063489914 seconds. IDL> b='toto' & a='tutu' & tic & for i=0l,30000 do c=a+b & toc % Time elapsed: 0.010015011 seconds. But in fact, doing nothing special is also slow:
GDL> b='toto' & a='tutu' & tic & for i=0l,30000 do wait,0 & toc % Time elapsed : 0.054697037 seconds. IDL> b='toto' & a='tutu' & tic & for i=0l,30000 do wait,0 & toc % Time elapsed: 0.0017919540 seconds. The real time spent in 'byte' is when you remove the time in doing nothing else than a loop, i.e., 0.063489914 -054697037 = 0.008. Loops are already discouraged in IDL in favor of vectorization, in GDL it is at the moment 10+ times worse! This probably because of the creation/destruction of objects inherent(?) of the C++ programming. Obviously there must be a way to improve this situation, help from C++ gurus will be needed though.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Not urgent.
I am working a lot with strings and ascii files and use a lot the str_sep function which is very slow compared to IDL. Inside there is used the "byte" function and this "simple" function is already 40 times slower than IDL:
Is there any chance to speed this up?