INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Which is quicker  (Read 1691 times)

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Which is quicker
« on: April 16, 2002, 07:08:21 am »

How efficient is MJFilesAutomation.GetFile(n)?

For example in the album view plugin I'm writing I read every track one (using GetFile) and pick out the bits of data I need to determine if an album is "complete".   Then when a user clicks on an album I reread the data via GetFile and show the tracks and a breakdown of the track the user has selected.

So I am thinking would it be better for me to extract the data and store it in internal buffers as opposed to keep calling GetFile?



Rhino.
Logged

Nikolay

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1681
  • Former CTO, JRiver, Inc.
RE:Which is quicker
« Reply #1 on: April 16, 2002, 07:47:57 am »

GetFile is very fast. Internally it creates new pointer to existing structure.

Nikolay
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
RE:Which is quicker
« Reply #2 on: April 16, 2002, 07:52:55 am »

It depends, but MJFiles->GetFile(...) is very fast. A file automation object is actually just a filename, with lots of wrapping.  So internally it's fairly light weight.  The only thing you may want to cache is the results of GetImageFile(...) because that has to actually analyze the file's tag.

Take care.

-Matt
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
RE:Which is quicker
« Reply #3 on: April 16, 2002, 08:07:24 am »

By the way Rhino,

If you still have questions (from our emails), will you post them here?

That way Nikolay and I will know if your questions have been answered, and we may even help somebody else.

Thanks.

-Matt
Logged
Matt Ashland, JRiver Media Center

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
RE:Which is quicker
« Reply #4 on: April 16, 2002, 08:47:06 am »

Thanks Nikolay/Matt.

I won't bother copying the data now that you've convinced me that it's efficient Next Page


Also I noticed the image speed issue when I was dealing with internal images.

Doing a scan of my 3000 tracks takes 3 seconds normally ... when I ask for internal images (where there is only 1 out of the 3000) it takes around 5 minutes (that's why it's disabled at the moment).   Is there any way to speed this up, e.g. hold a flag in your DB if the file contains an image, the byte offset within the file that the image starts, the length of the image and the image type.

You take the hit up front (slower import) but the benefits are tremendous.

For example I could open the file as a memory mapped file and extract/paint the image onto the screen as necessary.


Also I'll do all my communications from now on thru this board ... but is it still ok to announce alpha's/beta's in the main board?



Rhino.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
RE:Which is quicker
« Reply #5 on: April 16, 2002, 10:40:24 am »

About the internal images, we don't have a great answer for Media Jukebox 8.0.  We strongly recommend external linkage for this (and several other) reasons.  Sorry...

>but is it still ok to announce alpha's/beta's in the main board

Of course.  You're making a great addition to MJ -- spread the joy.

-Matt
Logged
Matt Ashland, JRiver Media Center
Pages: [1]   Go Up