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

  • Home
  • SEARCH
  • 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 1097193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:23:46+00:00 2026-05-17T00:23:46+00:00

I was wondering what would be the best approach to split up array processing

  • 0

I was wondering what would be the best approach to split up array processing using multiple queued functions into small time chunks?

So say I have an multi dimensional array, and I want to run a function(s) over it, but only in small timed chunks, say 500ms each time I trigger the processing to occur.

What would be the best approach?

One way I can think of is using psuedo code

#get time 
#loop_marker:
#if current function_to_run is None
#   pop function to run off queue store
#
#run function_to_run once
#increment start_index (in array) for next time or set function_to_run to None if finished array 
#check time_diff
#if time_diff < limit - time_diff (i.e. if we can run this function again before hitting the limit)
#   goto loop_marker
#else 
#    yield

Obviously this is not very Pythonic. So any ideas? Any cleaner ways?

I cannot install anything on the machine its processing on apart from python 2.5

  • 1 1 Answer
  • 1 View
  • 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-05-17T00:23:47+00:00Added an answer on May 17, 2026 at 12:23 am

    You could set up a queue of functions to run as a generator that would yield each run, then have a small loop that looked like this:

    time_elapsed = 0
    for func in function_queue_generator:
        if time_elapsed > time_limit:
            yield
            time_elapsed = 0
        func()
    

    Such a generator could be implemented like so, perhaps:

    def run_func_on_args(input_arg_sets, func):
        for argset in input_arg_sets:
            yield lambda: func(argset)
    

    There are many possible ways you could create such a generator; the above is just a simple example. You could create generators to run functions across multidimensional arrays, et cetera.

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

Sidebar

Related Questions

I am wondering what would be the best approach to store, for let's say
I was wondering what the best approach would be to search a database via
I was wondering what would be the best approach for creating tables in a
I'm wondering what would be the best approach to render vector objects (e.g. box,
I was wondering what would be the best approach towards finding the index of
I was wondering what the best approach would be to the following problem. Say
I am wondering what the best approach would be to check whether or not
I am wondering what would be the best approach in a WPF (possibly MVVM)
I was wondering what would be the best approach to make a Grails app
I was wondering what the best approach would be for the following situation: I

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.