[Javascript] Javascript and threads

twlewis at SoftHome.net twlewis at SoftHome.net
Mon May 28 09:49:35 CDT 2007


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/
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list