Re: [Django] #27513: Optimize Signal.send a tiny bit

2016-11-22 Thread Django
#27513: Optimize Signal.send a tiny bit
-+-
 Reporter:  Adam Chainz  |Owner:  Adam
 Type:   |  Chainz
  Cleanup/optimization   |   Status:  closed
Component:  Utilities|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"22a60f8d0b331bf06c066ccba4eea5bb5e4ac9f2" 22a60f8d]:
 {{{
 #!CommitTicketReference repository=""
 revision="22a60f8d0b331bf06c066ccba4eea5bb5e4ac9f2"
 Fixed #27513 -- Made Signal.send()/send_robust() a tiny bit faster.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.5345cecddcd7ca6fc0700cf4620ad582%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27513: Optimize Signal.send a tiny bit

2016-11-20 Thread Django
#27513: Optimize Signal.send a tiny bit
-+-
 Reporter:  Adam Chainz  |Owner:  Adam
 Type:   |  Chainz
  Cleanup/optimization   |   Status:  assigned
Component:  Utilities|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Adam Chainz):

 `send()` with receivers can be optimized too with a list comprehension,
 avoiding temp var `response` and method calls on `responses`:

 {{{
 In [1]: %cpaste
 Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
 :def before(self, sender, **named):
 for receiver in self._live_receivers(sender):
 response = receiver(signal=self, sender=sender, **named)
 responses.append((receiver, response))
 return responses


 def after(self, sender, **named):
 return [
 (receiver, receiver(signal=self, sender=sender, **named))
 for receiver in self._live_receivers(sender)
 ]
 :

 In [3]: dis.dis(before)
   2   0 SETUP_LOOP  66 (to 69)
   3 LOAD_FAST0 (self)
   6 LOAD_ATTR0 (_live_receivers)
   9 LOAD_FAST1 (sender)
  12 CALL_FUNCTION1 (1 positional, 0 keyword pair)
  15 GET_ITER
 >>   16 FOR_ITER49 (to 68)
  19 STORE_FAST   3 (receiver)

   3  22 LOAD_FAST3 (receiver)
  25 LOAD_CONST   1 ('signal')
  28 LOAD_FAST0 (self)
  31 LOAD_CONST   2 ('sender')
  34 LOAD_FAST1 (sender)
  37 LOAD_FAST2 (named)
  40 CALL_FUNCTION_KW   512 (0 positional, 2 keyword pair)
  43 STORE_FAST   4 (response)

   4  46 LOAD_GLOBAL  1 (responses)
  49 LOAD_ATTR2 (append)
  52 LOAD_FAST3 (receiver)
  55 LOAD_FAST4 (response)
  58 BUILD_TUPLE  2
  61 CALL_FUNCTION1 (1 positional, 0 keyword pair)
  64 POP_TOP
  65 JUMP_ABSOLUTE   16
 >>   68 POP_BLOCK

   5 >>   69 LOAD_GLOBAL  1 (responses)
  72 RETURN_VALUE

 In [4]: dis.dis(after)
  10   0 LOAD_CLOSURE 0 (named)
   3 LOAD_CLOSURE 1 (self)
   6 LOAD_CLOSURE 2 (sender)
   9 BUILD_TUPLE  3
  12 LOAD_CONST   1 ( at
 0x1068b5930, file "", line 10>)
  15 LOAD_CONST   2 ('after..')
  18 MAKE_CLOSURE 0

  11  21 LOAD_DEREF   1 (self)
  24 LOAD_ATTR0 (_live_receivers)
  27 LOAD_DEREF   2 (sender)
  30 CALL_FUNCTION1 (1 positional, 0 keyword pair)
  33 GET_ITER
  34 CALL_FUNCTION1 (1 positional, 0 keyword pair)
  37 RETURN_VALUE
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.79d8b0eb6730a585e8b8cffb3ed91e7d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27513: Optimize Signal.send a tiny bit

2016-11-20 Thread Django
#27513: Optimize Signal.send a tiny bit
-+-
 Reporter:  Adam Chainz  |Owner:  Adam
 Type:   |  Chainz
  Cleanup/optimization   |   Status:  assigned
Component:  Utilities|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Markus Holtermann):

 * version:  1.10 => master
 * stage:  Unreviewed => Ready for checkin


Comment:

 LGTM

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1c08aeae7b36469465011efa3218838a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27513: Optimize Signal.send a tiny bit

2016-11-20 Thread Django
#27513: Optimize Signal.send a tiny bit
-+-
 Reporter:  Adam Chainz  |Owner:  Adam
 Type:   |  Chainz
  Cleanup/optimization   |   Status:  assigned
Component:  Utilities|  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Adam Chainz):

 * cc: me@… (added)


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a63d7436c46a5b7ae74cff70e716a394%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27513: Optimize Signal.send a tiny bit

2016-11-20 Thread Django
#27513: Optimize Signal.send a tiny bit
-+-
 Reporter:  Adam Chainz  |Owner:  Adam
 Type:   |  Chainz
  Cleanup/optimization   |   Status:  assigned
Component:  Utilities|  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Adam Chainz):

 * owner:  nobody => Adam Chainz
 * status:  new => assigned
 * has_patch:  0 => 1


Comment:

 https://github.com/django/django/pull/7581

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.2d1b4fdd629392d6db18e1ce17b90a27%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.