473,473 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Speed of data access in arrays

Will calling ksort() on an array speed up it's access?

For example, I have the array $file_index, which is accessed by a key (the
entry id) and has two sub elements in a one dimensional array (line number
of the start of the entry in the file, and the byte offset of the start of
the entry).

so, I might have an array that can be represented thus:

{
2 => {1, 100),
4 => (30, 556),
10 => (376, 2637),
...
}

These usually have thousands of entries, so the arrays are quite large, and
anything I can do to speed up the data access will be big.

One file, contains under 10MB of data in under 2000 entries, the next
contains about 35MB of data in around 8000 entries, and the final contains
about 125MB of data in 20000+ entries, and I'm noticing significant lag on
the latter, so I was hoping to find a way to speed up the array access.
Thanks for the help
-Jim Stapleton
Jul 16 '05 #1
6 4827
Steven James Samuel Stapleton wrote:
One file, contains under 10MB of data in under 2000 entries, the next
contains about 35MB of data in around 8000 entries, and the final contains
about 125MB of data in 20000+ entries, and I'm noticing significant lag on
the latter, so I was hoping to find a way to speed up the array access.


No, sorting won't help.

--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007
Jul 16 '05 #2
Does anyone know of a way to speed up the access?

-Jim Stapleton
-PCF

"Adam i Agnieszka Gasiorowski FNORD" <ag*****@venus.ci.uw.edu.pl> wrote in
message news:3F***************@venus.ci.uw.edu.pl...
Steven James Samuel Stapleton wrote:
One file, contains under 10MB of data in under 2000 entries, the next
contains about 35MB of data in around 8000 entries, and the final contains about 125MB of data in 20000+ entries, and I'm noticing significant lag on the latter, so I was hoping to find a way to speed up the array access.


No, sorting won't help.

--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007

Jul 16 '05 #3
Steven James Samuel Stapleton wrote:
Does anyone know of a way to speed up the access?

-Jim Stapleton
-PCF

"Adam i Agnieszka Gasiorowski FNORD" <ag*****@venus.ci.uw.edu.pl> wrote in
message news:3F***************@venus.ci.uw.edu.pl...
Steven James Samuel Stapleton wrote:
> One file, contains under 10MB of data in under 2000 entries, the next
> contains about 35MB of data in around 8000 entries, and the final contains > about 125MB of data in 20000+ entries, and I'm noticing significant lag on > the latter, so I was hoping to find a way to speed up the array access.


No, sorting won't help.


Store it in a DBMS like MySQL - that's what they're designed to do
Jul 16 '05 #4
> Store it in a DBMS like MySQL - that's what they're designed to do

A DBMS is faster than an array?

-Jim Stapleton
Jul 16 '05 #5
Steven James Samuel Stapleton wrote...
Does anyone know of a way to speed up the access?


Have you tried increasing the memory limit in php.ini?
memory_limit = 256M
.... maybe buy more RAM for you computer

HTH
Jul 16 '05 #6
Steven James Samuel Stapleton wrote:
Store it in a DBMS like MySQL - that's what they're designed to do


A DBMS is faster than an array?

-Jim Stapleton


No, but it's faster than dealing with a file, reading it in and parsing
it, sorting an array, etc, as tyhe code in a DBMS is optimised for the
tasks, rather than generalised coding support.

You'll probably also find thjat a good DBMS will scale better on certain
operations with large sets of data
Jul 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: grv | last post by:
So it is supposed to be very fast to have an array of say 5 million integers stored in a binary file and do a = numarray.fromfile('filename', (2, 2, 2)) numarray.add(a, 9, a) but how is that...
10
by: Fabian | last post by:
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...
4
by: Lost Bits | last post by:
Hello there C++ pros.. Well, I have recently redesigned an already existing piece of code that someone else designed - its just a search algorithm they developed, and has to perfomr millions of...
8
by: Darsant | last post by:
I'm currently reading 1-n number of binary files, each with 3 different arrays of floats containing about 10,000 values a piece for a total of about 30,000 values per file. I'm looking for a way...
60
by: Neil | last post by:
I have a situation with an ODBC linked view in an Access 2000 MDB with a SQL 7 back end. The view is scrolling very slowly. However, if I open the view in an ADP file, it scrolls quickly. I...
2
by: Roy Gourgi | last post by:
Hi, My program seems to slow down drastically because as I fill my array and table with many values, the program suffers tremendously. The first thing my program does is to search the jagged...
8
by: Julien Fiore | last post by:
Hi, I wrote a function to compute openness (a digital elevation model attribute). The function opens the gdal-compatible input raster and reads the values in a square window around each cell. The...
5
by: pt | last post by:
Hi, i am wonderng what is faster according to accessing speed to read these data structure from the disk in c/c++ including alignment handling if we access it on little endian system 32 bits...
10
by: Ali Chambers | last post by:
Hi, I've written a programme that processes stock market price data in VB.NET 2005 Express. I've optimised the code as much as possible, eg:- using arrays, not passing parameters to functions,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.