Performance of System V Style Shared Memory Support in Python 3.8

Evaluation

Test Code

Result and Observation

Without shared memory
data 99 ints : 0.004216 secs per iteration
data 999 ints : 0.004034 secs per iteration
data 9,999 ints : 0.004522 secs per iteration
data 99,999 ints : 0.012110 secs per iteration
With shared memory
data 99 ints : 0.005805 secs per iteration
data 999 ints : 0.015656 secs per iteration
data 9,999 ints : 0.718858 secs per iteration
data 99,999 ints : 67.926538 secs per iteration

Clearly, the performance based on shared memory is worse (4x, 179x, 6792x) that the performance based on non-shared memory.

Questions

  1. Is (de)serialization of vanilla lists of primitive types optimized in Python?
  2. If so, this evaluation suggests ShareableList will not improve performance when used with vanilla lists of primitive types. However, ShareableList can only contain int, float, bool, string, bytes, and None values. So, under what circumstances will ShareableList improve performance?
  3. Also, in general, under what circumstances will the new shared memory support improve the performance?

Summary

Note

Software Engineer / Researcher interested in software engineering, programming languages/tools, systems, and data.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Venkatesh-Prasad Ranganath

Venkatesh-Prasad Ranganath

Software Engineer / Researcher interested in software engineering, programming languages/tools, systems, and data.

More from Medium

Import custom python modules

What are Environment Variables?

SQLite: Lightweight Disk-Based Database

FUNCTIONS IN PYTHON