mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
13f691bc37
commit
5f7006e2cb
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -83,7 +83,7 @@ jobs:
|
|||||||
uses: jirutka/setup-alpine@v1
|
uses: jirutka/setup-alpine@v1
|
||||||
with:
|
with:
|
||||||
arch: x86
|
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
|
- name: Build and Test
|
||||||
run: |
|
run: |
|
||||||
uname -m
|
uname -m
|
||||||
|
@ -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
|
|
@ -1,6 +1,3 @@
|
|||||||
try:
|
|
||||||
import os
|
|
||||||
except ImportError:
|
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
os.chdir('benchmarks')
|
os.chdir('benchmarks')
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
is_cpython = hasattr(sys, 'getrefcount')
|
|
||||||
|
|
||||||
if is_cpython:
|
|
||||||
class vec2:
|
class vec2:
|
||||||
def __init__(self, x, y):
|
def __init__(self, x, y):
|
||||||
self.x = x
|
self.x = x
|
||||||
@ -13,8 +10,6 @@ if is_cpython:
|
|||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.x == other.x and self.y == other.y
|
return self.x == other.x and self.y == other.y
|
||||||
else:
|
|
||||||
from linalg import vec2
|
|
||||||
|
|
||||||
x = vec2(0, 0)
|
x = vec2(0, 0)
|
||||||
for i in range(10000000):
|
for i in range(10000000):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user