Page 1 of 1

Slideshow random jumps are limited to 32K.

Posted: Wed Jun 18, 2008 11:17 pm
by Fuhrer
I make a slideshow sequence with 50000-80000 files.
I set "Use random order" checkbox.
When slideshow starts, it jumps only within first 32000 files.
PageUp/PageDown is OK, I can choose any image this way.
I think the problem is in the function you are using to jump to a random image. Looks like you are using integer, not Long or something.


The second problem is speed.
It takes a veeery long time to load some huge slideshow (as above).
Is there some ability to increase the speed? Maybe avoiding many disk reads (IO operations) would make some sence?

Thanks, Fuhrer
<-- removed* -->

My System is:
Windows XP SP3.
Celeron 420 @ 1.6 Ghz
3GB Ram.

<-- * E-mail address removed by moderator (see “Rules and Guidelines”) -->

Re: Slideshow random jumps are limited to 32K.

Posted: Thu Jun 19, 2008 2:10 pm
by xnview
Fuhrer wrote:I make a slideshow sequence with 50000-80000 files.
I set "Use random order" checkbox.
When slideshow starts, it jumps only within first 32000 files.
PageUp/PageDown is OK, I can choose any image this way.
I think the problem is in the function you are using to jump to a random image. Looks like you are using integer, not Long or something.
And when you don't use random, no problem?
The second problem is speed.
It takes a veeery long time to load some huge slideshow (as above).
Is there some ability to increase the speed? Maybe avoiding many disk reads (IO operations) would make some sence?
Perhaps it's because the EXE is very very big, so OS need some times to load it

Re: Slideshow random jumps are limited to 32K.

Posted: Fri Jun 20, 2008 6:20 pm
by Fuhrer
xnview wrote: And when you don't use random, no problem?
No problem that way, like I sad:
Fuhrer wrote:PageUp/PageDown is OK, I can choose any image this way.
The same no problem in automatic mode: it just loads next image. The problem appears only in random mode, either automatic, or keyboard/mouse. It just doesn't jump to image who's index is over 32768.
xnview wrote:
Maybe avoiding many disk reads (IO operations) would make some sence?
Perhaps it's because the EXE is very very big, so OS need some times to load it
No, really. Exe size means nothing if your antivirus doesn't try to scan it all every time you start it. I don't have antivirus, so EXE size doesn't matter for me. Indeed, 0.5 GB slideshow (500 megabytes, 170 jpegs in it) starts in about 1 or 2 seconds. That's fast.
I was talking about on-line slideshows, those that run directly using XnView, not by the created EXE. The loading time is measured from the moment when I open some big slide-show sequence (*.sld) till the moment when I can start it. If slideshow is big enough (100000 photos), it takes a few minutes to load.
Actually, I was wrong - XnView doesn't make disk reads during that "hung" state. It makes some internal IO's. Maybe filling listbox slows down? Anyway, loading big slideshows takes nearly longer, then creating new ones.

Re: Slideshow random jumps are limited to 32K.

Posted: Sun Jun 22, 2008 6:25 pm
by xnview
Fuhrer wrote: The same no problem in automatic mode: it just loads next image. The problem appears only in random mode, either automatic, or keyboard/mouse. It just doesn't jump to image who's index is over 32768.
And the list of files in the slideshow dialog is correct?
xnview wrote:
xnview wrote:
Maybe avoiding many disk reads (IO operations) would make some sence?
Perhaps it's because the EXE is very very big, so OS need some times to load it
No, really. Exe size means nothing if your antivirus doesn't try to scan it all every time you start it. I don't have antivirus, so EXE size doesn't matter for me. Indeed, 0.5 GB slideshow (500 megabytes, 170 jpegs in it) starts in about 1 or 2 seconds. That's fast.
I was talking about on-line slideshows, those that run directly using XnView, not by the created EXE. The loading time is measured from the moment when I open some big slide-show sequence (*.sld) till the moment when I can start it. If slideshow is big enough (100000 photos), it takes a few minutes to load.
Actually, I was wrong - XnView doesn't make disk reads during that "hung" state. It makes some internal IO's. Maybe filling listbox slows down? Anyway, loading big slideshows takes nearly longer, then creating new ones.
Ok, please try the 1.94 beta 2 when will be available...

Re: Slideshow random jumps are limited to 32K.

Posted: Mon Jun 23, 2008 5:58 pm
by Guest
xnview wrote: And the list of files in the slideshow dialog is correct?
It Seems to be Ok, dont see any problem there.
xnview wrote: Ok, please try the 1.94 beta 2 when will be available...
A bit better, but still not good. Just one more thins to do.
In short: do not use "Random()*Random()", just use "Random()". If it's clear, then just don't read the rest.

In long: the next explain.
Let us say our random() function returns number from 0 to 1. Of cource, the statistical average vill be 0,5. That means that if you add a hundred of random nubrers you'll get some number around 50.
But for the same reason "random()*random()" will give us an average of 0,25. In practice this means that most of pictures will be selected from the fist quater of the whole range, much less out of the secong quarter, and very few from the second half. Maybe it will be more clear in the graphic.

[img=http://i.piccy.kiev.ua/i2/0b/11/5ca8d63 ... 0cd38.jpeg]

The Testing condition was:
100071 jpeg in slide-show
60 random pics taken as reference.

Re: Slideshow random jumps are limited to 32K.

Posted: Mon Jun 23, 2008 7:14 pm
by xnview
Anonymous wrote:
xnview wrote: Ok, please try the 1.94 beta 2 when will be available...
A bit better, but still not good. Just one more thins to do.
The test was for this bug
I was talking about on-line slideshows, those that run directly using XnView, not by the created EXE. The loading time is measured from the moment when I open some big slide-show sequence (*.sld) till the moment when I can start it. If slideshow is big enough (100000 photos), it takes a few minutes to load.
In short: do not use "Random()*Random()", just use "Random()". If it's clear, then just don't read the rest.

In long: the next explain.
Let us say our random() function returns number from 0 to 1. Of cource, the statistical average vill be 0,5. That means that if you add a hundred of random nubrers you'll get some number around 50.
But for the same reason "random()*random()" will give us an average of 0,25. In practice this means that most of pictures will be selected from the fist quater of the whole range, much less out of the secong quarter, and very few from the second half. Maybe it will be more clear in the graphic.
Sorry but i don't understand. All pictures will be shown once per random "session". I don't use random each time when showing a picture.

Re: Slideshow random jumps are limited to 32K.

Posted: Tue Jun 24, 2008 8:38 am
by Fuhrer
xnview wrote:
Anonymous wrote:
xnview wrote: Ok, please try the 1.94 beta 2 when will be available...
A bit better, but still not good. Just one more thins to do.
The test was for this bug
Oh, sorry! It's my fault (2 problems in one topic).
I is really much faster than before. Ver 1.93.6 loaded 100000 photos in 2 minutes 40 seconds. Ver 1.94 b2 did the same in 32 seconds! That's a great progress.
And a little more of measurements. A slideshow *.SLD with 470000 photos loaded in 25 minutes. The slideshow started in 2 minutes 45 seconds after pushing "Go" button. In random mode no picture with index of more than 50000 was shown. Most of all were about 5000-20000. I looked for the first 50-100 photos in a slideshow.
xnview wrote:
In short: do not use "Random()*Random()", just use "Random()".
Sorry but i don't understand.
It's my fault. I can't explain clearly because of my bad english.
xnview wrote:All pictures will be shown once per random "session". I don't use random each time when showing a picture.
Yes, it was obvious before you said it. I wonder why I didn't think about it before. Hmm, so you shuffle images before starting a slige-show? Then it seems that problem is in that shuffle. Let us return to my yesterday's tests. I started a slideshow of 100000 images in random mode. I wrote down index numbers of 30 images in a row. Later I repeated the test, so i have an indexes of 60 images that XnView has shown in 100000-image slideshow. here are the numbers (sorry for such big column, I don't know how to hide it):

Code: Select all

12535
14155
30838
31711
31928
34085
22227
23029
35628
35800
36064
9613
22416
20613
24810
25417
1569
2727
28381
34795
2822
36829
435
8129
18542
18775
16881
3349
26124
12554
12486
6612
6712
21846
25672
7133
5040
12408
18305
19950
6517
20008
8081
24934
1721
5656
6106
8607
20568
22475
23209
22034
18128
25259
21909
25263
17395
21040
22290
9644
As you see there was not shown any image with index number more than 40000. That is what I an talking about.

Re: Slideshow random jumps are limited to 32K.

Posted: Sat Jun 28, 2008 6:45 am
by entryway
Fuhrer wrote:When slideshow starts, it jumps only within first 32000
Probably it happened because rand() was used in xnview. The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. RAND_MAX is equal to 32767

MS: http://msdn.microsoft.com/en-us/library ... 71%29.aspx
POSIX: http://www.opengroup.org/onlinepubs/000 ... /rand.html

Re: Slideshow random jumps are limited to 32K.

Posted: Sat Jun 28, 2008 12:45 pm
by xnview
entryway wrote: Probably it happened because rand() was used in xnview. The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. RAND_MAX is equal to 32767
Right, it's the problem :-)

Posted: Sun Jul 06, 2008 4:38 pm
by Fuhrer (unregistered)
Finally I can answer (had some network problems).
The problem with randoms seems to be solved. Jumps are OK.

There is still much to do with speed optimizations, but that's another question, I think we can return to it's discussion later.