rf hu kiteb:
[color=blue]
> "Fabian" <lajzar@hotmail.com> wrote in message
> news:bo7msf$1ac74q$1@ID-174912.news.uni-berlin.de...[color=green]
>> Lee hu kiteb:
>>[color=darkred]
>>> Fabian said:
>>>>
>>>> Are there any speed issues in javascript with having really large
>>>> arrays? I know if the array gets large enough, bandwidth and
>>>> download time can be an issue, but does it take inordinate amounts
>>>> of time to access a really large array?
>>>
>>> That depends on what you consider to be "really large".
>>>
>>> I wrote a simple script that creates an array of a given size,
>>> loops through the array setting each element equal to 1,
>>> <notes how long this has taken>
>>> then loops through the array, adding up all those 1's, and
>>> <notes how long this has taken>
>>>
>>> I ran this in Netscape 7.1 and IE 6, with arrays of size
>>> 10,000, 100,000 and 1,000,000 elements, recording the time
>>> in seconds to initialize the array, and then to access each
>>> element (totalling them). All of the times were near zero
>>> except at 1 million elements. That took Netscape 3 seconds
>>> to initialize and 2 seconds to access, and IE 20 seconds(!)
>>> to initialize but also 2 seconds to access all elements.[/color]
>>
>> The maximum array size I was envisioning was going to be 10,000 by
>> 20,000. I originally envisioned single character text, but there is
>> no functional reason they couldn't be nunbers, and numbers probably
>> work better in js anyway. Nice to know I am unlikely to hit any speed
>> barriers here.[/color]
>
> GAK. 10,000 by 20,000. Hmmm lets see, even if this were a character
> array that would be <calculates /> a 190+ megabyte array. Any
> computer with less than half a gig of memory would grind to a halt in
> the paging subsystem.
>
> What *are* you trying to do?[/color]
That was the maximum *theoretical* size. I would be somewhat surprised
if i ever actually used an array that size. Basically, I was thinking of
virtually dividing the world's surace into 3 mile squares, then creating
a pseudo-virtual reality.
Oh well.
Lets see. 100k^0.5 is 316. I guess I can do something with a grid that
size.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk