Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 676
    • Issues 676
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

April 05-07 - Mercurial Paris Conference 2023 - One day of workshop dedicated to Heptapod and Mercurial usage and workflow. There are still places available for both workshops and talks!

  • PyPyPyPy
  • pypypypy
  • Merge requests
  • !549

merge faster-rstruct-2

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Bitbucket Importer requested to merge branch/faster-rstruct-2 into branch/default May 23, 2017
  • Overview 4
  • Commits 110
  • Pipelines 0
  • Changes 52

Created originally on Bitbucket by antocuni (Antonio Cuni)

The main goal of the branch is to make struct faster; in particular:

  1. struct.unpack is now optimized for all kind of buffers, including bytearray and raw buffers; previously, the fast path was taken only for strings

  2. struct.pack_into is now optimized: it uses native store ops whenever possible (gc_store_indexed or raw_store) and writes directly to the buffer (previously it was implemented in terms of pack + setslice): I measured speedups up to 7x.

  3. struct.pack is faster as well: previously it was based on StringBuilder and produced the resulting string piece-by-piece: now it preallocates a buffer of the right size and fills it using the same logic as pack_into.

The branch contains a lot of refactorings and new features; here are what I think are the most important and/or delicate ones:

  1. introduced rlib.buffer.Buffer.typed_{read,write}, so that each buffer type can decide if and how to implement them (e.g. by using raw_{load,store} or gc_{load,store}_indexed depending on the type of underlying buffer)

  2. refactored rlib/rstruct and pypy/module/struct to make advantage of the new buffer interface

  3. added rlib/mutbuffer.py: this preallocates and RPython string but acts like a buffer so that you can write things to it; when you are done, you call finish(), you the the high-level rpython str and you are forbidden to make more writes

  4. added llop.gc_store_indexed and fixed the zillion of places which needed it

  5. taught writeanalyze.py about llop.gc_{load,store}_indexed: the idea is that they generate the same effect as a "normal" write to the same data (so for example, 'interiorfield' to for STR.chars and array for LIST.items)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: branch/faster-rstruct-2