[Javascript] Javascript and threads

John Warner john at jwarner.com
Mon May 28 15:13:44 CDT 2007


I think you have confused server side with client side code. You text
file / database are on the server where your ASP (NET) code resides. I
for sure would not send 20 meg of text file to a client over the
internet without warning him first. You can indeed do multi threading on
the server using the thread objects  found in the dotnet libraries.
There are lots and lots of examples in both VB and C# on the internet,
just google using thread and your preferred dotnet language. BTW if a
twenty megabyte array is giving you memory errors, you might want to get
the hardware on the server checked out. 20Meg cached is not anywhere
close to too much for .NET to keep up with and manage. Another option
with your MDB file is cache the data into a dataset and then disconnect
from the database. Then you can run queries against your dataset
table(s). But this discussion is wandering far from the topic here and
should be redirected to an ASP.NET list. But everything I mentioned here
has examples on the various dotnet websites that can be found using
Google.

Sounds to me like this really isn't a JavaScript issue.

John Warner


> -----Original Message-----
> From: javascript-bounces at LaTech.edu 
> [mailto:javascript-bounces at LaTech.edu] On Behalf Of 
> twlewis at SoftHome.net
> Sent: Monday, May 28, 2007 10:50 AM
> To: [JavaScript List]
> Subject: Re: [Javascript] Javascript and threads
> 
> 
> Thank you Nick.  My problem is this:
> I have a log file that can be more than 20M.  It is a text 
> file.  I need the best way to search that file for certain 
> criteria.  In my current code, I create an Access database, 
> read the file into the database, and then run SQL statements 
> to find the data.  That is the best idea that I can come up 
> with.  I originally had it loading into an array, but putting 
> it into a database and using the SQL commands actually runs 
> better.  The array also kept causing me out of memory errors.
> 
> > On 28 May 2007, at 15:07:09, twlewis at SoftHome.net wrote:
> >
> >> Can threads be implemented in Javascript (such as nsIThread)?
> >>
> >> Thanks for any help or websites.
> >> Tim
> >
> > No. A browser runs JavaScript in a single thread. If you 
> want to have 
> > several independent processes running apparently simultaneously, 
> > you'll have to implement some kind of time-slicing mechanism using 
> > setTimeout or setInterval:
> >
> > <http://developer.mozilla.org/en/docs/DOM:window.setTimeout>
> > <http://developer.mozilla.org/en/docs/DOM:window.setInterval>
> >
> > If you're doing something like multiple animated elements, 
> which is a 
> > common reason for wanting thread-like capabilities in 
> JavaScript, then 
> > you might want to consider taking advantage of one of the many JS 
> > libraries out there which have done all the hard work for 
> you. I can 
> > recommend the Yahoo! User Interface Library:
> >
> > <http://developer.yahoo.com/yui/>
> >
> > Regards,
> >
> > Nick.
> > --
> > Nick Fitzsimons
> > http://www.nickfitz.co.uk/





More information about the Javascript mailing list