Ticket #8431 (closed defect: fixed)

Opened 6 years ago

Last modified 4 years ago

Invoke python with -OO to save memory

Reported by: cscott Owned by: dsd
Priority: normal Milestone: 10.1.1
Component: sugar Version: Development build as of this date
Keywords: Cc:
Action Needed: test in build Verified: no
Deployments affected: Blocked By: #8438
Blocking:

Description

The sugar shell and any long lived services should invoke python with -OO to save memory. This saves about 6M of memory space, at the cost of NAND space for the .pyo files.

This bug will track investigation into this issue, as discussed in http://lists.laptop.org/pipermail/devel/2008-September/019078.html (and the referenced previous discussion and buzilla/numpy bugs).

Change History

Changed 6 years ago by cscott

I've begun by putting patched versions of python 2.5.1 and numpy into joyride, with the fixes linked to from http://scipy.org/scipy/numpy/ticket/893 and https://bugzilla.redhat.com/show_bug.cgi?id=460334

Both these patches are upstream, and have appeared in python 2.5.2/will appear in numpy 1.2.0, so we won't be carrying these patches long.

Putting the patched versions in joyride will make it easier for experimenters to quantify the costs by editing their local image to turn on -OO and generating the appropriate .pyo files.

Changed 6 years ago by cscott

  • blockedby 8438 added

Changed 6 years ago by cscott

With the patch for #8438, I've edited /usr/bin/sugar-shell to change the first line to #!/usr/bin/python2.5 -OO and run without any obvious problems.

For speed I also generated .pyo files as follows:

$ python2.5 -OO
>>> import compileall
>>> compileall.compile_path()
>>> compileall.compile_dir('/usr/share/sugar/shell')

I haven't determined how much extra space the .pyo files add to the image, but in devel@ it was suggested that we generate .pyo files *instead* of .pyc files -- so the net result should be a savings in NAND space.

Changed 4 years ago by dsd

  • milestone changed from Opportunity to 1.5-future

As of F11 those python and numpy bugs are fixed and after compiling all pyo objects, a quick PYTHONOPTIMIZE=2 export in olpc-session doesn't break anything obvious. would be nice to revisit this.

Changed 4 years ago by Quozl

  • milestone changed from 1.5-future to 1.5-software-update

Changed 4 years ago by dsd

  • owner changed from cscott to dsd

I plan to remove all pyc files from the build and replace them with pyo. This will save about 3mb of disk space. I'll add the PYTHONOPTIMIZE to olpc-session. This will affect all programs opened under Sugar and GNOME. I also checked that Sugar, the presence service, and the datastore are all started in this mode too.

Changed 4 years ago by dsd

  • next_action changed from never set to test in build

olpc-utils-1.0.15 ready for testing in next build

Changed 4 years ago by Quozl

  • milestone changed from 1.5-software-later to 1.5-software-update

Changed 4 years ago by cjb

test in os102

Changed 4 years ago by RafaelOrtiz

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.