Lloyd Bryant wrote:
> >Christian Biere wrote:
> > > I wanted to sort the index by the modification time, so that browse host
> > > would show the newest files first. Maybe you want to implement this as 
> >well?

> >Actually, it should be newest last, at least the indices to keep them 
> >stable.
> >The browse host output could of course be upside-down.

 
> Let me take a look at that one.  The "browse host" feature has been giving 
> me a ton of grief lately - most of the nodes I want to browse have it 
> disabled, and the rest seem to have 20,000+ files.  Seems like some people 
> like to share their entire hard drive....

20,000+ is most-likely spam. Are you thinking of the same Gtk-Gnutella node
that I have in mind?

> BTW: Are you aware of the CPU load that's generated when you have a sort 
> active while it's loading a 20,000 item browse list? :-)

Yes, of course, it's an O(n^2) algorithm as far as I can see. That's why
I disable sorting for hidden searches. That may cause some stalling when
you switch to a search but that's not as bad as constantly eating a huge
amount of CPU time whilst results arrive. Albeit this isn't complete,
sorting should also be disabled when the search pane is hidden. The same
applies to the downloads pane.

> I'm not sure that "most recent first" is the best option, however.  If you 
> regularly browse the same hosts (to see if they've added anything that 
> interests you) this does make sense,

Yes, that's what I had in mind of course. I sometimes download files to a
fast server and then grab them from there. Actually, we should put this
information into results. The problem is that the timestamp is not available
from results, so you can't sort by it. There's some GGEP 'CT' but that
refers to the "global" create time. I'm not sure it's a good idea to recycle
this feature albeit I suspect this information is often bogus anyway, so
a local but correct timestamp isn't so bad. Or maybe we add our own "MT"
(modification time) GGEP field.

>  but for general GNet usage, where you 
> don't know which host you'll be looking at on a given day, having an Alpha 
> sort might make like easier (or sort by extension, then by alpha).  Perhaps 
> a configuration option to determine the default order for browse results.

Well, you can alphanumerically on the client side. Albeit that takes some
CPU time, I don't think that's much of an issue. You can set a default
sorting from the context menu, but that applies to all searches, not just
browsing.

> Without having looked at the relevant code, I'd suggest doing this during 
> each "rescan", and just saving the list in a particular order.  Sorting each 
> time a browse occurs could generate a lot of unnecessary CPU load...

Yes, of course. The shared files are listed in a big array, so you can
just do a qsort after rescan. Watch out for possible holes in this array
though.

> Only if random_value() returns something other than 0 if you do a 
> "random_value(0)".  In which case I would consider it to be a bug in 
> "random_value()".  To tell the truth, I never really considered that 
> scenario (I'm glad someone is looking for obvious problems....).

I was thinking of a division by zero but I was just misreading it, so
there's no such issue. I replaced random_value(x) with random_raw() % x
though because the former uses floating-point arithmetic and I can
never remember whether it returns x or (x-1) at maximum whereas it's
obvious for random_raw() % x.

-- 
Christian

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Gtk-gnutella-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to