INTERACT FORUM

Please login or register.

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

Author Topic: Tag() expression and the cache...  (Read 1852 times)

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Tag() expression and the cache...
« on: August 29, 2011, 05:34:02 pm »

It appears there is no caching of file tags, which makes using Tag() in an expression column pretty rough going.

Just out of curiosity, I wanted to check my REPLAYGAIN_TRACK_GAIN tags against [Replay Gain], and found that it took several minutes to display the expression column:

    Tag(REPLAYGAIN_TRACK_GAIN)

Once populated, clicking a single entry in the column took several more minutes, so it seems MC rescans the physical tags again for ALL 17k+ audio files.  And again for any other operation.

Can MC cache these values once looked up, at least while they are in a view?
Logged
The opinions I express represent my own folly.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Tag() expression and the cache...
« Reply #1 on: August 29, 2011, 06:03:15 pm »

It appears there is no caching of file tags, which makes using Tag() in an expression column pretty rough going.

The database is the cache.  Using [Replay Gain] will be very fast.  Using Tag(...) will go to the physical file.

If you sort, it is careful to only evaluate the expression once per file.

I don't think adding a caching layer to expressions is a great idea, because some expressions change with time with Counter(...), or do other things where a caching layer will cause trouble.

In general, use expressions sparingly.  They are an order of magnitude slower than using the database directly.
Logged
Matt Ashland, JRiver Media Center

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tag() expression and the cache...
« Reply #2 on: August 29, 2011, 07:31:12 pm »

I probably wasn't too clear.  I'm on-board with the internal DB fields/values vs. the physical tags/values distinction, and how MC uses them.

(But your answer I think hints to me more about how MC is working internally to present pane column data initially and after each selection)

I was interested in exploring a physical file tag for all files, in this particular case, REPLAYGAIN_TRACK_GAIN.  Out of curiosity, I was going to compare those tags with [Replay Gain] db values (taking into account the 6db change, of course).

Doing this, I happened to notice that some REPLAYGAIN_TRACK_GAIN file tags had " db" after the decimal, and recall Alex (I think) mentioning this many moons ago.  I also recall there was some change a while back in the way MC wrote out various gain tags, so I simply wanted to compare, mostly to see what worked.

So I created a Tag(REPLAYGAIN_TRACK_GAIN) expression column as a test, to grab the values so I could see them all.  But selecting anything in the panes column takes too long to be useful.  It seems the column expression is re-run to obtain the selected file list.  I was thinking the content of panes was cached, and making a selecting just winnowed those results.

But, as you suggest, using the expression in the File list, although painful the first run, is fine afterwards.

I agree, adding a caching layer is not necessary, especially not for my unorthodox uses. :-)
Logged
The opinions I express represent my own folly.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Tag() expression and the cache...
« Reply #3 on: August 29, 2011, 08:52:20 pm »

One thing you can do is create a user library field.  Let's call it "MrC".

You can then devise some fancy expression.  Pick all your files, and edit the field "MrC" with =[insert fancy expression here]

This will store the result of the expression for each file.  It may take a little while, but will only evaluate the expression once for each file.

After that, you can use the field [MrC] for sorting, searching, in views, etc. and it will be fast.

In essence, this creates a caching layer that you can control as the user.
Logged
Matt Ashland, JRiver Media Center

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tag() expression and the cache...
« Reply #4 on: August 29, 2011, 09:35:32 pm »

I've become so accustomed to the speed of your Regex() implementation and using my new fancy views for instantaneous access, that thought hadn't yet found its way into my Neanderthal skull.

A perfectly fine solution, thanks.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tag() expression and the cache...
« Reply #5 on: August 30, 2011, 01:09:34 pm »

So it appears that Tag(REPLAYGAIN_TRACK_GAIN) will remove the 6db bias from the physical tag.l

Is there a way of returning a raw, unbiased tag value?  Eg:

  Tag(REPLAYGAIN_TRACK_GAIN, 1)

where 1 says Don't Muck with Me.
Logged
The opinions I express represent my own folly.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Tag() expression and the cache...
« Reply #6 on: August 30, 2011, 02:01:22 pm »

So it appears that Tag(REPLAYGAIN_TRACK_GAIN) will remove the 6db bias from the physical tag.l

Is there a way of returning a raw, unbiased tag value?  Eg:

  Tag(REPLAYGAIN_TRACK_GAIN, 1)

where 1 says Don't Muck with Me.

Not really.  Input plugins always return data in the format the program expects.

This is a matter of degrees, since the "raw unbiased tag value" is really a blob of binary data.
Logged
Matt Ashland, JRiver Media Center

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tag() expression and the cache...
« Reply #7 on: August 30, 2011, 02:23:20 pm »

Got it.

So the Tag dump contents in the Tag Action Window must be already formatted and handed to MC by the input plug in...
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up