cseverino / qlcolorcode

Automatically exported from code.google.com/p/qlcolorcode
0 stars 0 forks source link

highlight process takes a long time to run on large files, isn't quit when necessary #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Select a large file in column view, or quicklook a large file - for example 
a 3+ MB SQL file.
2. The 'highlight' process is started in the background to generate the 
thumbnail/preview.
3. Select another file - the 'highlight' process continues to run.  After 
several files are selected, 
multiple 'highlight' processes are running, each asking for as much CPU as 
possible.

What is the expected output? What do you see instead?
I would expect that the highlight process is stopped if the file is 
deselected/the quicklook 
window closed.  It doesn't appear to be.

What would perhaps be even better, to avoid severe slowdowns on large files (I 
have quite a few 
20MB SQL dumps kicking around, and kick myself whenever I select them in column 
view!) would 
be to only preview/highlight the first 100k of text or so.  It makes the 
preview slightly less 
complete, true, but would be so much lighter on the processor!

What version of the product are you using? On what operating system?
0.4.1 on 10.5.2 - also occurred in 10.5.1.

Please provide any additional information below.
This plugin is already indispensable for me, but very irritating because I have 
large sql dumps 
sitting in quite a few places (I can't imagine this is a common problem with 
code files!).  A 
"head"-type size limit alone would sort this problem out in a good way, because 
the other 
problem is that the previews take a long, long time to generate for large files 
- and most of the 
time you're only concerned with glancing at the first few pages of content 
anyway.
 PS - The long version string refers to version 1.0 of the product.

Original issue reported on code.google.com by rowanb@gmail.com on 4 Mar 2008 at 3:31

GoogleCodeExporter commented 8 years ago
I'll accept the bug and do a workaround, but this is really an Apple bug (and 
I've reported it long ago).  They 
generate a full QL preview any time you highlight a file in column view, but 
they never use it, not even if you 
subsequently *ask* for a QL preview of the file.  FYI, my thumbnail generator 
only uses a small portion of the file 
for good performance.  Unfortunately, this bad behavior in the Finder makes me 
look sloppy regardless.  :-(

Original comment by n8gray@gmail.com on 5 Mar 2008 at 7:39

GoogleCodeExporter commented 8 years ago
> FYI, my thumbnail generator only uses a small portion of the file 
for good performance

This sounded a little odd to me, so I just checked the source - and you are 
quite right!  Except the problem is actually 
with SQL dumps, which can use very, very long lines indeed.

So:
    filter=(head -n 100)
Actually reads in the entirety of the file, which can be multi-megabytes.

So perhaps this could be improved by using:
    filter=(head -n 100 | head -c 10000)
...to use up to 100 lines and only up to 10k of text?

(Incidentally: This still only affects the thumbnail, by the look of it, so 
perhaps it's worth putting a higher limit on full 
quicklooks - say 5,000 lines and 500k?  Just to avoid death...)

Original comment by rowanb@gmail.com on 5 Mar 2008 at 1:20

GoogleCodeExporter commented 8 years ago
That thumbnail mod sounds fine.  I think I'll make the limit on full previews 
an opt-in setting.  I sometimes QL 
plist files that are a few MB long.

Original comment by n8gray@gmail.com on 11 Mar 2008 at 8:52

GoogleCodeExporter commented 8 years ago
This is fixed in SVN.  You can use the maxFileSize to specify the maximum file 
size in bytes.

Original comment by n8gray@gmail.com on 27 Mar 2008 at 1:07