Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Exclamation Help redrawing large image

    I have a 600x600 applet that redraws each pixel (drawing the mandelbrot set).

    Right now (just using a for loop and paint() method) it swipes down drawing the pixels and takes a couple seconds.

    I tried to draw an image offscreen and paint that on but it still took the same amount of time since it needed to still draw each pixel to the offscreen image.

    I was wondering what I need to do to make it faster. Would threads be the solution?

    Thanks

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    can you do threads with the mandelbrot set ?

    i would guess if you model the image area as two images adjacent, like cut the image in half horizontally, and then have two threads to render each half concurrently, to see if that does indeed do a speedup.

    typically a Java thread would map to a host system CPU or CPU core, so if a user only has one CPU, subdividing a lot to make it work on several threads won't necessarily improve performance.

    Though now a days, 2-4 cores are more common than they used to. I guess you could get fancy with an option for how many worker threads to use and then go with that, dividing the image into pieces.

  3. #3
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default

    Thanks for the reply I'll try it out.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I wonder if you could use memoization to speed up your calculations (Jos's previous suggestion on this has now got it stuck in my brain!)?

  5. #5
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,233
    Rep Power
    7

Similar Threads

  1. Large data over RMI
    By JavaDesigner in forum New To Java
    Replies: 7
    Last Post: 10-16-2009, 08:48 PM
  2. Reading large XML
    By gkumar in forum XML
    Replies: 3
    Last Post: 08-06-2009, 04:38 AM
  3. Creating Large projects
    By Mr.Beans in forum New To Java
    Replies: 1
    Last Post: 04-07-2009, 01:38 AM
  4. Compare 2 large files
    By bezudar in forum Advanced Java
    Replies: 3
    Last Post: 11-23-2008, 02:18 AM
  5. problem in redrawing JTable
    By abhinav in forum AWT / Swing
    Replies: 0
    Last Post: 11-21-2007, 09:08 PM

Posting Permissions

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