Re: Re-read an image
- From: "John Marcovici" <johnmarcovici@xxxxxxxxxxxxxxx>
- Date: Fri, 6 Apr 2007 00:43:25 -0400
IA,
Thanks for the tip. I'll have to try that and see if it will achieve
my goal of bogging down my programs! Just kidding, obviously I do not
want to slow my progs down. My interest in the matter is
benchmarking; I have several implementations of the exact same
function --- read an image, and downsample it --- and I want to have
a shoot out. I want to know who's fastest. And I can't do that if I
run one and then the other and then the other, because the first will
do all the legwork and will appear absurdly slow. Know what I mean?
Maybe I could get the same result by running several instances of
Matlab, but geez, that gets complicated. I just wanted an easy way to
run each prog say, 10 times, and then compare.
Thanks,
John
ImageAnalyst wrote:
<johnmarcov...@xxxxxxxxxxxxxxx>
John:
You can make MATLAB "forget" the variable it just read by using the
clear command. This is not the same as clearing the cache. MATLAB
is
not doing the caching - the drive adapter is. Perhaps there is
some
way of using some low level API command (not a MATLAB command) to
clear the disk cache, however I don't know how without digging into
it
and I don't know why you'd want to. Why on earth would you want to
make your program slower??!?!? I suppose you could read some
temporary, intermediate file that is located on a different part of
the disk. That would fill up the cache with a different set of
data.
Then when you went to read the part you want, the cache would not
be
valid (because it doesn't hold the sectors you're looking for) and
it
would have to retrieve it from disk (which also loads the cache
with
the new data).
Regards,
ImageAnalyst
==============================================
On Apr 3, 9:15 am, "John Marcovici"
wrote:the
Thanks for explainer. I suspected something to do with cachingwas at
play but honestly don't understand computers at that level. Nowhow
can I clear out that cache <==> make Matlab forget about
firstimage it just read?programs
ImageAnalyst wrote:
This is normal and happens all the time, even when loading
and other data. Have you ever heard of disk caching? The
Thentime
you read that image, it's most likely not in ram memory.
itreads a
must
go to the drive and read it off the disk - it actually
bytes.bunch
of sectors around your image, not just your exact image
Thea
memory off the disk platter then gets sent to the CPU but
copy ofram
the sectors gets stored in ram (I'm not certain where this
is.This
I
think it's on the drive but maybe in your computer/cpu).
isand
so
that the next time you want it, it will be pulled from ram
notthis
have to read the disk - this will make it faster. They do
wantsbecause they noticed that often the next read a computer
towhere
do
happens to come from the sectors of the disk right near
thethey
last
read was, so they might as well just store it in ram. If
weresame
right, it's faster, if they were wrong, well it's just the
asmalloc or
it
would be with no caching.
Regards,
ImageAnalyst
On Apr 3, 2:22 am, "John Marcovici"
<johnmarcov...@xxxxxxxxxxxxxxx>
wrote:
Since we were talking about memory allocation using
few DLL'smxMalloc, I decided to run a few experiments using a
andI
had
laying around. They essentially read in large images
an image,downsample
them. No big deal. However, I noticed that if I read
Ifthen
read it again, the second read is drastically faster.
faster thansomeone
can
explain why it is that subsequent reads are much
important tothe
first, I would be interested to know. But, more
me"clean",
at
the moment, how can I force subsequent reads to be
I wantthat
is,
re-read from scratch? Doing a clear all does not help.
.to
apparentlyforce Matlab to forget that it just read the image and
knows how.
Thanks,
John- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
- Follow-Ups:
- Re: Re-read an image
- From: Peter Boettcher
- Re: Re-read an image
- From: John Marcovici
- Re: Re-read an image
- References:
- Re-read an image "clean"
- From: John Marcovici
- Re: Re-read an image "clean"
- From: ImageAnalyst
- Re: Re-read an image
- From: John Marcovici
- Re: Re-read an image
- From: ImageAnalyst
- Re-read an image "clean"
- Prev by Date: Re: mxGetLogicals
- Next by Date: Re: Re-read an image
- Previous by thread: Re: Re-read an image
- Next by thread: Re: Re-read an image
- Index(es):
Relevant Pages
|
Loading