<br><br><div class="gmail_quote">On Wed, Apr 27, 2011 at 10:34 PM, Alex Mizrahi <span dir="ltr"><<a href="mailto:killerstorm@newmail.ru">killerstorm@newmail.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> Currently, I do something along the lines of the following on the results<br>
> on get-instance[s]-by-XXX functions:<br>
> (remove-if #'(lambda (x) (not (member ',class-name (mapcar #'class-name<br>
> (sb-mop:class-precedence-list x))))) lst :key #'class-of)<br>
> if I want results on the whole inheritance chain, or<br>
> (remove-if #'(lambda (x) (not (equal ',class-name x)))) lst :key<br>
> #'class-of) if I want result on the specific class.<br>
<br>
</div>I wonder why not just typep?<br>
It should be enough to answer any reasonable class-related query.</blockquote><div><br></div><div>Yes I was wondering the same thing yesterday...  Lisp newbie here. Not well acquainted with the tools yet :) </div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
> Now I know that efficiency is the issue here, but my (naive , since I<br>
> havent had performance problems yet) response to that is that since the<br>
> the search is indexed anyway, does it really matter?<br>
> I mean since the complexity of the search is logarithmic wont the separate<br>
> hierachical index implementation you propose have diminishing returns?<br>
<br>
</div>If you consider only search then yes, in theory there should be no<br>
significant difference.<br>
<br>
But if multiple instances are returned you'll just have more data read and<br>
sent to the Lisp side, so it will be proportionally slower.<br>
<br>
Le'ts consider a situation when you have one base class and M subclasses,<br>
and each subclass has N instances matching a query on average.<br>
Then with simple inherited index you'll have N*M instances read from<br>
database, while direct index on subclass would return only N.<br>
Thus M times more data is read.<br></blockquote><div><br></div><div>I totally agree with the rationale. How realistic this simple estimate is, I agree (as you imply below) depends on the application.</div><div>  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

But it depends on expected value of N. If it is low (e.g N*M<1) then query<br>
time will be dominated by search but not data read or transfer. So it<br>
doesn't matter in this case.<br>
But if you queries you run typically return many instances it might be a<br>
problem.</blockquote><div><br></div><div>You mean many instances of the subclasses dont you?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>
<div class="h5">
_______________________________________________<br>
elephant-devel site list<br>
<a href="mailto:elephant-devel@common-lisp.net">elephant-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/mailman/listinfo/elephant-devel" target="_blank">http://common-lisp.net/mailman/listinfo/elephant-devel</a><br>
</div></div></blockquote></div><br>