diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 08c43847..43bfa37a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,7 +83,7 @@ jobs: uses: jirutka/setup-alpine@v1 with: arch: x86 - packages: gcc make cmake libc-dev linux-headers python3 + packages: gcc g++ make cmake libc-dev linux-headers python3 - name: Build and Test run: | uname -m diff --git a/benchmarks/ldtk_cjson.py b/benchmarks/ldtk_cjson.py deleted file mode 100644 index 5fcc6714..00000000 --- a/benchmarks/ldtk_cjson.py +++ /dev/null @@ -1,46 +0,0 @@ -try: - import os -except ImportError: - exit(0) - -import sys -is_pkpy = not hasattr(sys, 'getrefcount') - -os.chdir('benchmarks') - -if is_pkpy: - try: - import cjson as json - except ImportError: - print('[cJSON not Enabled]') - exit(0) -else: - import json - -_2489KB = 'WorldMap_GridVania_layout.ldtk' -_1093KB = 'WorldMap_Free_layout.ldtk' -_339KB = 'Typical_2D_platformer_example.ldtk' - -with open(f'res/{_2489KB}', 'r') as f: - json_content = f.read() - -data: dict = json.loads(json_content) -assert isinstance(data, dict) - -# serialize and deserialize -dumped: str = json.dumps(data) -for _ in range(10): - loaded: dict = json.loads(dumped) -assert len(data) == len(loaded) -assert data == loaded - -#### very very slow!! -import pickle - -with open(f'res/{_339KB}', 'r') as f: - json_content = f.read() -data: dict = json.loads(json_content) - -data_pickled: bytes = pickle.dumps(data) -assert isinstance(data_pickled, bytes) -assert pickle.loads(data_pickled) == data \ No newline at end of file diff --git a/benchmarks/ldtk_json.py b/benchmarks/ldtk_json.py index 5aaf480e..1c9f82ee 100644 --- a/benchmarks/ldtk_json.py +++ b/benchmarks/ldtk_json.py @@ -1,7 +1,4 @@ -try: - import os -except ImportError: - exit(0) +exit(0) os.chdir('benchmarks') diff --git a/benchmarks/vec.py b/benchmarks/vec.py index 8a12d8c7..1703378c 100644 --- a/benchmarks/vec.py +++ b/benchmarks/vec.py @@ -1,20 +1,15 @@ import sys -is_cpython = hasattr(sys, 'getrefcount') +class vec2: + def __init__(self, x, y): + self.x = x + self.y = y -if is_cpython: - class vec2: - def __init__(self, x, y): - self.x = x - self.y = y + def __add__(self, other): + return vec2(self.x + other.x, self.y + other.y) - def __add__(self, other): - return vec2(self.x + other.x, self.y + other.y) - - def __eq__(self, other): - return self.x == other.x and self.y == other.y -else: - from linalg import vec2 + def __eq__(self, other): + return self.x == other.x and self.y == other.y x = vec2(0, 0) for i in range(10000000):