drneau.com Forum Index drneau.com
A discussion board for drneau.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Memory memory memory

 
Post new topic   Reply to topic    drneau.com Forum Index -> Development and Release News
View previous topic :: View next topic  
Author Message
drneau
Site Admin


Joined: 13 Feb 2005
Posts: 2385
Location: Woodbury, MN

PostPosted: Wed Jul 11, 2007 2:59 pm    Post subject: Memory memory memory Reply with quote

Images and audios.

In v2, I loaded them all into memory upon startup. This required memory.

Some people complained about memory, but I really didn't have a good indication of how much memory images or audios really took up.

When I started working on v3, I added the columns to the component designer to tell you how much space on disk was occupied by your images and audios, so you could get a general idea of how much memory they occupied. I knew that they actually took up more space in memory, but I still didn't know how much.

I was focusing on this the other day and I implemented the code to display "space in memory" rather than "space on disk".

OMG. What did I find? My sample 1552x1164 jpeg that took up about 505KB on disk was taking up 5MB after I loaded it into memory!!! Add a couple dozen or so of those images to your repository and the app will get pretty bogged down...This isn't really under my control...it has to do with image compression for storage vs. how they are handled in memory.

Audios are the same way, although not quite as drastic from what I found.

The reason I went with storing audios and images in memory originally was to make them available to the client...when the client connected I'd fire the audio/image bits over to the client so that it could store them in memory.

Here's my strategy for v3, which appears to work great.
- Images and audios are no longer loaded into memory upon startup. Instead, the components that used to hold them now point to their locations in the repository. My worry about this strategy initially was a delay in playing audios or displaying images, because they would be loaded from disk on demand.
- When an audio is played, a stream is opened to the file. Little memory required. From my tests, there's absolutely no noticable delay from the time I hit "play". I'm really pleased.
- When an image is required to be displayed (on a console, in the library, etc.), it is streamed from disk into a buffer. There's a tiny delay noticable here, but it's sub-second.
- For transmitting to a client, I'm simply going to pick up the *file*, send it to the client and have the client throw it into its repository. Then the client streams from disk the same way the server does.

Just wanted to let you all know performance is taking a leap forward for v3!
_________________
--
Dr. Neau (not a real doctor)
http://drneau.com
http://home.comcast.net/~jneau
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dix
"Royal Flush - No Hat"


Joined: 17 Jun 2005
Posts: 246
Location: W.Poland Maine - USA

PostPosted: Wed Jul 11, 2007 10:10 pm    Post subject: Re: Memory memory memory Reply with quote

drneau wrote:
OMG. What did I find? My sample 1552x1164 jpeg that took up about 505KB on disk was taking up 5MB after I loaded it into memory!!! Add a couple dozen or so of those images to your repository and the app will get pretty bogged down...This isn't really under my control...it has to do with image compression for storage vs. how they are handled in memory.


Right... I commented on this a while back when someone was asking about an issue related to images.

A "jpeg" (or most any image format other than bitmap - "BMP") is a "compressed" file... which windows expands to BMP format (it's native display format) and places in memory.

So yea.... a 500 or 600KB jpg file on disk can end up anywhere between 1-10MB in memory depending on the amount of compression used.
_________________
- Dix
Back to top
View user's profile Send private message Visit poster's website
drneau
Site Admin


Joined: 13 Feb 2005
Posts: 2385
Location: Woodbury, MN

PostPosted: Wed Jul 11, 2007 10:55 pm    Post subject: Re: Memory memory memory Reply with quote

Dix wrote:


Right... I commented on this a while back when someone was asking about an issue related to images.

A "jpeg" (or most any image format other than bitmap - "BMP") is a "compressed" file... which windows expands to BMP format (it's native display format) and places in memory.

So yea.... a 500 or 600KB jpg file on disk can end up anywhere between 1-10MB in memory depending on the amount of compression used.


I've got it down to this now...the only time it goes to disk for the image is:
- Each time the image is redisplayed on the screen, or
- Each time the image is resized (like if you maximize the console).

I have to get the image when you resize, or you'll notice that the image looks really bad when you make it small and then big again.

It's performing really well. I'm really happy.
_________________
--
Dr. Neau (not a real doctor)
http://drneau.com
http://home.comcast.net/~jneau
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dix
"Royal Flush - No Hat"


Joined: 17 Jun 2005
Posts: 246
Location: W.Poland Maine - USA

PostPosted: Fri Jul 13, 2007 5:29 am    Post subject: Reply with quote

Just in case anyone is curious....

Notice the "size in memory" and "original size on disk" numbers for this JPEG image, which was saved with a compression factor of "20", which is about average for most graphics apps in saving JPEG files.


_________________
- Dix
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    drneau.com Forum Index -> Development and Release News All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group