#11342: Make getattr faster on parents and elements
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |          Owner:                        
       Type:  enhancement  |         Status:  needs_review          
   Priority:  major        |      Milestone:  sage-4.7.2            
  Component:  performance  |       Keywords:  getattr parent element
Work_issues:               |       Upstream:  N/A                   
   Reviewer:               |         Author:  Simon King            
     Merged:               |   Dependencies:  #9944                 
---------------------------+------------------------------------------------

Comment(by vbraun):

 Sage-4.7.2.alpha1 segfaults with the patch applied:

 {{{
 [vbraun@volker-laptop-two sage]$ sage -gdb
 ----------------------------------------------------------------------
 | Sage Version 4.7.2.alpha1, Release Date: 2011-08-17                |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------
 **********************************************************************
 *                                                                    *
 * Warning: this is a prerelease version, and it may be unstable.     *
 *                                                                    *
 **********************************************************************
 /home/vbraun/Sage/sage/local/bin/sage-ipython
 GNU gdb (GDB) Fedora (7.3-41.fc15)
 Copyright (C) 2011 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 and "show warranty" for details.
 This GDB was configured as "x86_64-redhat-linux-gnu".
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>...
 Reading symbols from
 /home/vbraun/opt/sage-4.7.2.alpha1/local/bin/python...done.
 [Thread debugging using libthread_db enabled]
 Python 2.6.4 (r264:75706, Aug 20 2011, 21:29:24)
 [GCC 4.6.0 20110603 (Red Hat 4.6.0-10)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 Traceback (most recent call last):
   File "/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.16-gdb.py",
 line 59, in <module>
     from libstdcxx.v6.printers import register_libstdcxx_printers
   File "/usr/lib64/../share/gcc-4.6.0/python/libstdcxx/v6/printers.py",
 line 19, in <module>
     import itertools
 ImportError: No module named itertools

 Program received signal SIGSEGV, Segmentation fault.
 PyObject_GetAttr (v=0x0, name=0x1038378) at Objects/object.c:1174
 1174    Objects/object.c: No such file or directory.
         in Objects/object.c
 Missing separate debuginfos, use: debuginfo-install
 atlas-3.8.3-18.fc14.x86_64 expat-2.0.1-11.fc15.x86_64
 fontconfig-2.8.0-3.fc15.x86_64 glibc-2.14-5.x86_64 keyutils-
 libs-1.2-7.fc15.x86_64 krb5-libs-1.9.1-5.fc15.x86_64
 libcom_err-1.41.14-2.fc15.x86_64 libgcc-4.6.0-10.fc15.x86_64
 libselinux-2.0.99-4.fc15.x86_64 libstdc++-4.6.0-10.fc15.x86_64
 openssl-1.0.0d-1.fc15.x86_64
 (gdb) bt
 #0  PyObject_GetAttr (v=0x0, name=0x1038378) at Objects/object.c:1174
 #1  0x00007fffea27c2e1 in
 __pyx_pf_4sage_9structure_7element_7Element_3__getattr__ (
     __pyx_v_name=0x12b1530, __pyx_v_self=0x10eb418) at
 sage/structure/element.c:2795
 #2  __pyx_tp_getattro_4sage_9structure_7element_Element (n=0x12b1530,
 o=0x10eb418)
     at sage/structure/element.c:23398
 #3  __pyx_tp_getattro_4sage_9structure_7element_Element (o=0x10eb418,
 n=0x12b1530)
     at sage/structure/element.c:23394
 #4  0x00007ffff7d197ba in builtin_hasattr (self=<optimized out>,
 args=<optimized out>)
     at Python/bltinmodule.c:880
 #5  0x00007ffff7d225b5 in call_function (oparg=<optimized out>,
 pp_stack=0x7ffffffeccc0)
     at Python/ceval.c:3706
 #6  PyEval_EvalFrameEx (f=<optimized out>, throwflag=<optimized out>) at
 Python/ceval.c:2389
 #7  0x00007ffff7d242c9 in PyEval_EvalCodeEx (co=<optimized out>,
 globals=<optimized out>,
     locals=<optimized out>, args=<optimized out>, argcount=2, kws=0x0,
 kwcount=0, defs=0x0,
     defcount=0, closure=0x0) at Python/ceval.c:2968
 #8  0x00007ffff7cb0596 in function_call (func=0x1c57230, arg=0x2299488,
 kw=0x0)
     at Objects/funcobject.c:524
 #9  0x00007ffff7c8a763 in PyObject_Call (func=0x1c57230, arg=<optimized
 out>, kw=<optimized out>)
     at Objects/abstract.c:2492
 #10 0x00007ffff7c973bf in instancemethod_call (func=0x1c57230,
 arg=0x2299488, kw=0x0)
     at Objects/classobject.c:2579
 #11 0x00007ffff7c8a763 in PyObject_Call (func=0x1e725a0, arg=<optimized
 out>, kw=<optimized out>)
     at Objects/abstract.c:2492
 #12 0x00007fffeab5dab6 in
 __pyx_f_4sage_9structure_10parent_old_6Parent__coerce_c (
     __pyx_v_self=0x1ca5650, __pyx_v_x=0x10eb418,
 __pyx_skip_dispatch=<optimized out>)
     at sage/structure/parent_old.c:3711
 #13 0x00007fffeab5660e in
 __pyx_f_4sage_9structure_10parent_old_6Parent_has_coerce_map_from_c_impl (
     __pyx_v_self=0x1ca5650, __pyx_v_S=0x1089240) at
 sage/structure/parent_old.c:4914
 #14 0x00007fffeab55964 in
 __pyx_pf_4sage_9structure_10parent_old_6Parent_11has_coerce_map_from_impl
 (
     __pyx_v_self=0x1ca5650, __pyx_v_S=0x1089240) at
 sage/structure/parent_old.c:4802
 #15 0x00007ffff7c8a763 in PyObject_Call (func=0x1f95d88, arg=<optimized
 out>, kw=<optimized out>)
     at Objects/abstract.c:2492
 #16 0x00007fffeab58e41 in
 __pyx_f_4sage_9structure_10parent_old_6Parent_has_coerce_map_from_c (
     __pyx_v_self=0x1ca5650, __pyx_v_S=0x1089240,
 __pyx_skip_dispatch=<optimized out>)
     at sage/structure/parent_old.c:4659
 #17 0x00007fffeab54737 in
 __pyx_f_4sage_9structure_10parent_old_6Parent_coerce_map_from_c_impl (
     __pyx_v_self=0x1ca5650, __pyx_v_S=0x1089240) at
 sage/structure/parent_old.c:2638
 #18 0x00007fffeab55f64 in
 __pyx_pf_4sage_9structure_10parent_old_6Parent_2coerce_map_from_impl (
     __pyx_v_self=0x1ca5650, __pyx_v_S=0x1089240) at
 sage/structure/parent_old.c:2283
 #19 0x00007ffff7c8a763 in PyObject_Call (func=0x1f83e18, arg=<optimized
 out>, kw=<optimized out>)
     at Objects/abstract.c:2492
 #20 0x00007fffeab5a2a2 in
 __pyx_f_4sage_9structure_10parent_old_6Parent_coerce_map_from_c (
     __pyx_v_self=0x1ca5650, __pyx_v_S=0x1089240,
 __pyx_skip_dispatch=<optimized out>)
     at sage/structure/parent_old.c:1887
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11342#comment:18>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to