Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:22:05+00:00 2026-06-03T17:22:05+00:00

I’m developing a small web-based (javascript) ‘application’ for an art project. The thing is

  • 0

I’m developing a small web-based (javascript) ‘application’ for an art project. The thing is called ‘Poetry Generator’, and it’s a script that generates random poems based on user input.

The script has to display a random word to the user every 1/10th of a second. The wordlist used, counts 109.582 words.

I’ve already tried different solutions:

  1. put all the words in a text file, and get a random line of the textfile -> too slow (and the user has to download a 3MB text-file before being able to use the application)
  2. put all the words in an array in the Javascript. -> javascript arrays apparently can’t handle 109.585 items
  3. pull the words from a database using jQuery’s Ajax function with a Javascript interval function -> this solution worked perfectly when testing on my localhost, but once uploaded to a real web-environment, this method proved to be too slow. (And I could imagine that my hosting provider wouldn’t be so happy if I executed 10 query’s to their server every second.)

So.. Does anybody knows a different approach that I could use to show a random word on a webpage every 1/10th of a second? It doesn’t necessarily has to use php or javascript, as long as it runs in a browses, I’m happy!

Thanks in advance

Teis

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:22:07+00:00Added an answer on June 3, 2026 at 5:22 pm

    There’s no reason you have to pull the entire dataset every tenth of a second. Pull a reasonable amount from a database every minute (which would be about 600 words), load it into a local javascript object, and iterate through it.

    When either the array index becomes high enough or the timer hits one minute, poll for another set of 600.

    When dealing with times as low as a tenth of a second, you don’t want to have to invoke the server EVERY single time! You could even load the entire data set into memcached and poll for random words, thus skipping costly database calls, as the entire data set is loaded into memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Seemingly simple, but I cannot find anything relevant on the web. What is the
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.