summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-11 07:09:06 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-11 07:09:06 +0000
commit7faba198d640969a1f18e3d61d27673732d99893 (patch)
treebf2c50a45ee6756b02a509df99bc26b98165f1ff
parent91701bbac1ed89858c17318e34d0ff6bf326751f (diff)
automatic import of python-cbitstruct
-rw-r--r--.gitignore1
-rw-r--r--python-cbitstruct.spec279
-rw-r--r--sources1
3 files changed, 281 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..f1a2bad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/cbitstruct-1.0.9.tar.gz
diff --git a/python-cbitstruct.spec b/python-cbitstruct.spec
new file mode 100644
index 0000000..33dfbce
--- /dev/null
+++ b/python-cbitstruct.spec
@@ -0,0 +1,279 @@
+%global _empty_manifest_terminate_build 0
+Name: python-cbitstruct
+Version: 1.0.9
+Release: 1
+Summary: Faster C implementation of bitstruct
+License: MPL-2.0
+URL: https://github.com/qchateau/cbitstruct
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b9/e5/5562adfa22b709a6201e5e7b69d6b60439b009503bf556f9bbe110f1ddc8/cbitstruct-1.0.9.tar.gz
+BuildArch: noarch
+
+
+%description
+![License](https://img.shields.io/badge/license-MPL--2.0-brightgreen) [![Build Status](https://travis-ci.com/qchateau/cbitstruct.svg?branch=master)](https://travis-ci.com/qchateau/cbitstruct)
+
+# About
+
+`cbitstruct` is a C implementation of the `bitstruct` library. Credits to Erik Moqvist for the original `bitstruct` library available on [Github](https://github.com/eerimoq/bitstruct) and [pip](https://pypi.org/project/bitstruct/).
+
+The goal is to provide the same API an idealy to be able to interchange `import bitstruct` and `import cbitstruct as bitstruct`.
+
+Obvious increased performance comes with limitations described below.
+
+# Installation
+
+```bash
+pip3 install cbitstruct
+```
+
+# Documentation
+
+Please refer to the [`bitstruct` documentation](https://bitstruct.readthedocs.io/en/latest/) as the aim of this library is to provide the same API with increased performance.
+
+If you are not used to `bitstruct`, you should seriously consider using it first, before migrating to this library if you require higher performance.
+
+# Limitations
+
+| Limitation | Will it be lifted ? |
+|------------|---------------------|
+| All types except padding are limited to 64 bits | Maybe for 'raw' and 'text' types |
+| May not work on big-endian architectures | Maybe |
+| Exceptions differ from `bitstruct` | Probably not |
+| CPython only | Probably not |
+| Error messages are unclear | Will never be as clear as `bitstruct` |
+| Python >= 3.5 | No |
+
+Some limitations are there because I did not get the time or motivation to lift them up. Some other are deeply rooted into this library and may never be lifted.
+
+# Performance
+
+## Comparing to `bitstruct`
+
+The script available in `tests/test_perf.py` measures performance comparing to the `bitstruct` library.
+
+Here are the result "on my machine" (Ubuntu in Virtualbox on a laptop):
+```
+byteswap list of int | x 8.779 ( 8.638us -> 0.984us)
+byteswap str | x 17.466 ( 9.158us -> 0.524us)
+calcsize | x139.330 ( 61.060us -> 0.438us)
+compiled pack | x 47.389 ( 35.968us -> 0.759us)
+compiled pack_dict | x 27.184 ( 34.588us -> 1.272us)
+compiled pack_into | x 32.037 ( 38.650us -> 1.206us)
+compiled pack_into_dict | x 27.343 ( 37.718us -> 1.379us)
+compiled unpack | x 33.928 ( 31.278us -> 0.922us)
+compiled unpack_dict | x 21.627 ( 31.597us -> 1.461us)
+compiled unpack_from | x 30.622 ( 29.977us -> 0.979us)
+compiled unpack_from_dict | x 20.479 ( 30.936us -> 1.511us)
+pack | x 77.003 ( 103.030us -> 1.338us)
+pack_dict | x 53.254 ( 103.255us -> 1.939us)
+pack_into | x 82.829 ( 119.373us -> 1.441us)
+pack_into_dict | x 52.173 ( 108.135us -> 2.073us)
+unpack | x 78.459 ( 91.896us -> 1.171us)
+unpack_dict | x 40.287 ( 89.300us -> 2.217us)
+unpack_from | x 77.027 ( 91.202us -> 1.184us)
+unpack_from_dict | x 39.467 ( 88.043us -> 2.231us)
+```
+
+*Disclaimer:* these results may and will vary largely depending on the number of elements and types you pack/unpack. This script is provided as-is, and I will gladly accept an improved script providing more reliable results.
+
+
+## The dict API
+The `dict` API is marginally slower than the traditional one. As the packing/unpacking performance is quite high, the overhead of performing dictionary lookups and hashing significantly increas pack and unpacking duration.
+
+
+%package -n python3-cbitstruct
+Summary: Faster C implementation of bitstruct
+Provides: python-cbitstruct
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-cbitstruct
+![License](https://img.shields.io/badge/license-MPL--2.0-brightgreen) [![Build Status](https://travis-ci.com/qchateau/cbitstruct.svg?branch=master)](https://travis-ci.com/qchateau/cbitstruct)
+
+# About
+
+`cbitstruct` is a C implementation of the `bitstruct` library. Credits to Erik Moqvist for the original `bitstruct` library available on [Github](https://github.com/eerimoq/bitstruct) and [pip](https://pypi.org/project/bitstruct/).
+
+The goal is to provide the same API an idealy to be able to interchange `import bitstruct` and `import cbitstruct as bitstruct`.
+
+Obvious increased performance comes with limitations described below.
+
+# Installation
+
+```bash
+pip3 install cbitstruct
+```
+
+# Documentation
+
+Please refer to the [`bitstruct` documentation](https://bitstruct.readthedocs.io/en/latest/) as the aim of this library is to provide the same API with increased performance.
+
+If you are not used to `bitstruct`, you should seriously consider using it first, before migrating to this library if you require higher performance.
+
+# Limitations
+
+| Limitation | Will it be lifted ? |
+|------------|---------------------|
+| All types except padding are limited to 64 bits | Maybe for 'raw' and 'text' types |
+| May not work on big-endian architectures | Maybe |
+| Exceptions differ from `bitstruct` | Probably not |
+| CPython only | Probably not |
+| Error messages are unclear | Will never be as clear as `bitstruct` |
+| Python >= 3.5 | No |
+
+Some limitations are there because I did not get the time or motivation to lift them up. Some other are deeply rooted into this library and may never be lifted.
+
+# Performance
+
+## Comparing to `bitstruct`
+
+The script available in `tests/test_perf.py` measures performance comparing to the `bitstruct` library.
+
+Here are the result "on my machine" (Ubuntu in Virtualbox on a laptop):
+```
+byteswap list of int | x 8.779 ( 8.638us -> 0.984us)
+byteswap str | x 17.466 ( 9.158us -> 0.524us)
+calcsize | x139.330 ( 61.060us -> 0.438us)
+compiled pack | x 47.389 ( 35.968us -> 0.759us)
+compiled pack_dict | x 27.184 ( 34.588us -> 1.272us)
+compiled pack_into | x 32.037 ( 38.650us -> 1.206us)
+compiled pack_into_dict | x 27.343 ( 37.718us -> 1.379us)
+compiled unpack | x 33.928 ( 31.278us -> 0.922us)
+compiled unpack_dict | x 21.627 ( 31.597us -> 1.461us)
+compiled unpack_from | x 30.622 ( 29.977us -> 0.979us)
+compiled unpack_from_dict | x 20.479 ( 30.936us -> 1.511us)
+pack | x 77.003 ( 103.030us -> 1.338us)
+pack_dict | x 53.254 ( 103.255us -> 1.939us)
+pack_into | x 82.829 ( 119.373us -> 1.441us)
+pack_into_dict | x 52.173 ( 108.135us -> 2.073us)
+unpack | x 78.459 ( 91.896us -> 1.171us)
+unpack_dict | x 40.287 ( 89.300us -> 2.217us)
+unpack_from | x 77.027 ( 91.202us -> 1.184us)
+unpack_from_dict | x 39.467 ( 88.043us -> 2.231us)
+```
+
+*Disclaimer:* these results may and will vary largely depending on the number of elements and types you pack/unpack. This script is provided as-is, and I will gladly accept an improved script providing more reliable results.
+
+
+## The dict API
+The `dict` API is marginally slower than the traditional one. As the packing/unpacking performance is quite high, the overhead of performing dictionary lookups and hashing significantly increas pack and unpacking duration.
+
+
+%package help
+Summary: Development documents and examples for cbitstruct
+Provides: python3-cbitstruct-doc
+%description help
+![License](https://img.shields.io/badge/license-MPL--2.0-brightgreen) [![Build Status](https://travis-ci.com/qchateau/cbitstruct.svg?branch=master)](https://travis-ci.com/qchateau/cbitstruct)
+
+# About
+
+`cbitstruct` is a C implementation of the `bitstruct` library. Credits to Erik Moqvist for the original `bitstruct` library available on [Github](https://github.com/eerimoq/bitstruct) and [pip](https://pypi.org/project/bitstruct/).
+
+The goal is to provide the same API an idealy to be able to interchange `import bitstruct` and `import cbitstruct as bitstruct`.
+
+Obvious increased performance comes with limitations described below.
+
+# Installation
+
+```bash
+pip3 install cbitstruct
+```
+
+# Documentation
+
+Please refer to the [`bitstruct` documentation](https://bitstruct.readthedocs.io/en/latest/) as the aim of this library is to provide the same API with increased performance.
+
+If you are not used to `bitstruct`, you should seriously consider using it first, before migrating to this library if you require higher performance.
+
+# Limitations
+
+| Limitation | Will it be lifted ? |
+|------------|---------------------|
+| All types except padding are limited to 64 bits | Maybe for 'raw' and 'text' types |
+| May not work on big-endian architectures | Maybe |
+| Exceptions differ from `bitstruct` | Probably not |
+| CPython only | Probably not |
+| Error messages are unclear | Will never be as clear as `bitstruct` |
+| Python >= 3.5 | No |
+
+Some limitations are there because I did not get the time or motivation to lift them up. Some other are deeply rooted into this library and may never be lifted.
+
+# Performance
+
+## Comparing to `bitstruct`
+
+The script available in `tests/test_perf.py` measures performance comparing to the `bitstruct` library.
+
+Here are the result "on my machine" (Ubuntu in Virtualbox on a laptop):
+```
+byteswap list of int | x 8.779 ( 8.638us -> 0.984us)
+byteswap str | x 17.466 ( 9.158us -> 0.524us)
+calcsize | x139.330 ( 61.060us -> 0.438us)
+compiled pack | x 47.389 ( 35.968us -> 0.759us)
+compiled pack_dict | x 27.184 ( 34.588us -> 1.272us)
+compiled pack_into | x 32.037 ( 38.650us -> 1.206us)
+compiled pack_into_dict | x 27.343 ( 37.718us -> 1.379us)
+compiled unpack | x 33.928 ( 31.278us -> 0.922us)
+compiled unpack_dict | x 21.627 ( 31.597us -> 1.461us)
+compiled unpack_from | x 30.622 ( 29.977us -> 0.979us)
+compiled unpack_from_dict | x 20.479 ( 30.936us -> 1.511us)
+pack | x 77.003 ( 103.030us -> 1.338us)
+pack_dict | x 53.254 ( 103.255us -> 1.939us)
+pack_into | x 82.829 ( 119.373us -> 1.441us)
+pack_into_dict | x 52.173 ( 108.135us -> 2.073us)
+unpack | x 78.459 ( 91.896us -> 1.171us)
+unpack_dict | x 40.287 ( 89.300us -> 2.217us)
+unpack_from | x 77.027 ( 91.202us -> 1.184us)
+unpack_from_dict | x 39.467 ( 88.043us -> 2.231us)
+```
+
+*Disclaimer:* these results may and will vary largely depending on the number of elements and types you pack/unpack. This script is provided as-is, and I will gladly accept an improved script providing more reliable results.
+
+
+## The dict API
+The `dict` API is marginally slower than the traditional one. As the packing/unpacking performance is quite high, the overhead of performing dictionary lookups and hashing significantly increas pack and unpacking duration.
+
+
+%prep
+%autosetup -n cbitstruct-1.0.9
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-cbitstruct -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.9-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..8cb329b
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+6f2d78c6cac7314895bd724f9b750120 cbitstruct-1.0.9.tar.gz