bool-hybrid-array 9.10.21__tar.gz → 9.10.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.10.21
3
+ Version: 9.10.22
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -571,6 +571,7 @@ except OverflowError as e:
571
571
  * **9.10.19**:和9.10.18.post4相同,正式版本发布
572
572
  * **9.10.20**:优化性能,增加BHA_jit_log日志
573
573
  * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
574
+ * **9.10.22**:进一步优化Ask_BHA的性能
574
575
 
575
576
 
576
577
  ## **彩蛋:**
@@ -531,6 +531,7 @@ except OverflowError as e:
531
531
  * **9.10.19**:和9.10.18.post4相同,正式版本发布
532
532
  * **9.10.20**:优化性能,增加BHA_jit_log日志
533
533
  * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
534
+ * **9.10.22**:进一步优化Ask_BHA的性能
534
535
 
535
536
 
536
537
  ## **彩蛋:**
@@ -3,7 +3,7 @@ from types import ModuleType,FunctionType
3
3
  from . import core
4
4
  from .core import __builtins__,builtins
5
5
  from . import int_array
6
- __version__ = "9.10.21"
6
+ __version__ = "9.10.22"
7
7
  public_objects = []
8
8
  for name in dir(core):
9
9
  if not name.startswith("_"):
@@ -8,6 +8,14 @@ import operator,ctypes,gc,abc,types
8
8
  from functools import lru_cache
9
9
  from typing import Union,_GenericAlias
10
10
  hybrid_array_cache = []
11
+ try:
12
+ msvcrt = ctypes.CDLL('msvcrt.dll')
13
+ memcpy = msvcrt.memcpy
14
+ except:
15
+ libc = ctypes.CDLL('libc.so.6')
16
+ memcpy = libc.memcpy
17
+ memcpy.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t)
18
+ memcpy.restype = ctypes.c_void_p
11
19
  if 'UnionType' in types.__dict__:
12
20
  class Union:
13
21
  def __getitem__(self,*args):
@@ -786,18 +794,14 @@ def Ask_BHA(path):
786
794
  temp = mm.read().decode('utf-8').strip()
787
795
  temp = temp.split()
788
796
  temp2 = lambda x: BoolHybridArr(
789
- reduce(
790
- lambda acc, k: acc.append(0 if k < lead_zero else
791
- (n >> ((total_len - 1) - k)) & 1
792
- ) or acc,
793
- range(total_len),
794
- array.array('B',[])),
795
- hash_=F
796
- )if(
797
- n := int(x, base=16),
798
- lead_zero := len(x) - len(x.lstrip('0')),
799
- total_len := lead_zero + (n.bit_length() if n != 0 else 1)
800
- )else None
797
+ (
798
+ bit_stream := bytes(0 if k < lead_zero else (n >> ((total_len - 1) - k)) & 1 for k in range(total_len)),
799
+ arr := array.array('B', FalsesArray(total_len)),
800
+ memcpy(arr.buffer_info()[0], bit_stream, total_len),arr)[-1]
801
+ if(n := int(x, base=16),
802
+ lead_zero := len(x) - len(x.lstrip('0')),
803
+ total_len := lead_zero + (n.bit_length() if n else 1))
804
+ else array.array('B'))
801
805
  temp = BHA_List(map(temp2,temp))
802
806
  if len(temp) == 1:
803
807
  return temp[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.10.21
3
+ Version: 9.10.22
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -571,6 +571,7 @@ except OverflowError as e:
571
571
  * **9.10.19**:和9.10.18.post4相同,正式版本发布
572
572
  * **9.10.20**:优化性能,增加BHA_jit_log日志
573
573
  * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
574
+ * **9.10.22**:进一步优化Ask_BHA的性能
574
575
 
575
576
 
576
577
  ## **彩蛋:**
@@ -8,7 +8,7 @@ def get_long_description():
8
8
  return "一个高效的布尔数组(密集+稀疏混合存储,节省内存)"
9
9
  setup(
10
10
  name="bool-hybrid-array",
11
- version="9.10.21",
11
+ version="9.10.22",
12
12
  author="蔡靖杰",
13
13
  extras_require={"int_array":[]},
14
14
  author_email="1289270215@qq.com",