3 Star 0 Fork 0

alibaba/code-data-share-for-python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

code-data-share-for-python

https://img.shields.io/pypi/pyversions/code-data-share https://img.shields.io/pypi/implementation/code-data-share https://img.shields.io/badge/platform-linux--64%20%7C%20osx--64-lightgrey

Introduction

The main goal of code-data-share-for-python is to improve the efficiency of importing python module, including time and memory footprint, by persistence of code object of imported modules with a memory-mapped file.

For more information not included in this README, e.g. detailed user and developer guide, performance results, please refer to our wiki page.

Basic Usage

code-data-share-for-python provides mechanism to determine imported packages, dump a memory mapped file from the list of packages and import packages directly from the memory mapped file.

Install

pip install code-data-share

Determine the imported packages

# tracer: list imported packages to mod.lst
PYCDSMODE=TRACE PYCDSLIST=mod.lst python -c 'import json'

Create the memory-mapped file

# dumper: create archive named mod.img from mod.lst
python -c 'import cds.dump; cds.dump.run_dump("mod.lst", "mod.img")'

Import packages from archive

# replayer
PYCDSMODE=SHARE PYCDSARCHIVE=mod.img python -c 'import json'

AppCDS in Java

The design is inspired by the Application Class-Data Sharing (AppCDS) feature, introduced in OpenJDK. AppCDS allows a set of application classes to be pre-processed into a shared archive file, which can then be memory-mapped at runtime to reduce startup time and memory footprint.

MIT License Copyright (c) 2022 Alibaba Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
C 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_alibaba/code-data-share-for-python.git
git@gitee.com:mirrors_alibaba/code-data-share-for-python.git
mirrors_alibaba
code-data-share-for-python
code-data-share-for-python
main

搜索帮助