Results 1 to 10 of 35

Thread: Some gravity particles

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #19
    Also (a bit akin what Dan suggested) you can play with the condition affecting when to apply the force to particle:
    Code:
    if (d > 0) and (d < DISTANCE_TO_IGNORE)
    With distance set to 15 or so gives a nice speedup in later stages, when the particles spread out.
    Smaller distances (try 5) will give you more speedup in early stages but have a more noticeable effect on particle behavior (less tight clusters).
    Larger distances (100) cause slowdown in early stages
    Dynamically tuning the "ignore distance" would probably lead to best results (2xfaster execution shouldn't be a problem).

    As per more calculation threads than cores: if threads with similar workload start competing for resources, you'll get slowdowns from overheads associated with threads, scheduling, context switching, cache trashing and so on.


    Edit: you have an error within the last statement, (MAX_THREADS-2) should be (MAX_THREADS-1), otherwise the last thread will get more stars than it should (the same ones as in the prev. thread, not to mention it won't work with one thread
    Last edited by imcold; 14-06-2013 at 08:25 PM. Reason: code review

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •