[Glass] Can I avoid ReversedRangeIndexReadStream >> atEnd ?

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Wed Oct 25 07:01:38 PDT 2017


Hi Dale,

I am doing a query like this (as per your recommendation):


nearestQueryFor: aDate on: aCollection
| query |
query := GsQuery fromFormula: self nearestQuery  on: aCollection.
query bind: 'targetDate' to: aDate.
^ query

nearestQuery
^ nearestQuery ifNil: [
nearestQuery := GsQueryPredicate fromQueryStatement:  'each.date <=
targetDate'.
nearestQuery
].


And when I use it, I do this:

query := self nearestQueryFor: dateToCompare on: (self indexingDict at:
securityUniqueId).
stream := query reversedReadStream.
            ^ stream atEnd
                ifTrue: [ nil ]
                ifFalse: [ stream next ]

I am profiling some code that uses this a lot and I see that quite some
time is spent in the #atEnd.
I attach a part of the profiling output to see what I mean.

Do you see something obvious I can speed up?

Thanks in advance,

-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20171025/90eff426/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2017-10-25 at 10.59.36 AM.png
Type: image/png
Size: 101573 bytes
Desc: not available
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20171025/90eff426/attachment-0001.png>


More information about the Glass mailing list