[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #13821 [Stem]: Various optimisations to Stem



#13821: Various optimisations to Stem
-----------------------------+--------------------
     Reporter:  oherrala     |      Owner:  atagar
         Type:  enhancement  |     Status:  closed
     Priority:  normal       |  Milestone:
    Component:  Stem         |    Version:
   Resolution:  implemented  |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+--------------------
Changes (by atagar):

 * status:  new => closed
 * resolution:   => implemented


Comment:

 Fantastic, thanks! Pushed with some
 [https://gitweb.torproject.org/stem.git/commitdiff/4b980915168e3c712e7352c81c9c00671da7a075
 minor tweaks]. I'm surprised and a tad sad isinstance() isn't more
 performant. It should be a simple comparison of the class attribute...

 {{{
 >>> def my_isinstance(v, c):
 ...   return type(v) == c
 ...
 >>> my_isinstance('hello', str)
 True
 }}}

 ... or...

 {{{
 >>> def my_isinstance(v, c):
 ...   return v.__class__ == c
 ...
 >>> my_isinstance('hello', str)
 True
 }}}

 It made for slightly friendlier code. Are you sure dropping isinstance()
 had a substantial impact?

 If it did then there's a few other isinstance() calls in
 [https://gitweb.torproject.org/stem.git/blob/HEAD:/stem/util/str_tools.py
 str_tools].

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13821#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs