Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minijson
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
minijson
Commits
c7f78a08
Commit
c7f78a08
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
speed improvements
parent
3c318b62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
minijson.pyx
+4
-9
4 additions, 9 deletions
minijson.pyx
setup.cfg
+1
-1
1 addition, 1 deletion
setup.cfg
with
6 additions
and
10 deletions
CHANGELOG.md
+
1
−
0
View file @
c7f78a08
...
@@ -5,3 +5,4 @@ here's only the changelog for the version in development
...
@@ -5,3 +5,4 @@ here's only the changelog for the version in development
*
proofed against loading empty strings
*
proofed against loading empty strings
*
Python 3.6 is supported
*
Python 3.6 is supported
*
minor speed improvements
This diff is collapsed.
Click to expand it.
minijson.pyx
+
4
−
9
View file @
c7f78a08
...
@@ -44,13 +44,13 @@ cpdef void switch_default_double():
...
@@ -44,13 +44,13 @@ cpdef void switch_default_double():
global
float_encoding_mode
global
float_encoding_mode
float_encoding_mode
=
1
float_encoding_mode
=
1
cdef
tuple
parse_cstring
(
bytes
data
,
int
starting_position
):
cdef
inline
tuple
parse_cstring
(
bytes
data
,
int
starting_position
):
cdef
:
cdef
:
int
strlen
=
data
[
starting_position
]
int
strlen
=
data
[
starting_position
]
bytes
subdata
=
data
[
starting_position
+
1
:
starting_position
+
1
+
strlen
]
bytes
subdata
=
data
[
starting_position
+
1
:
starting_position
+
1
+
strlen
]
return
strlen
+
1
,
subdata
return
strlen
+
1
,
subdata
cdef
tuple
parse_list
(
bytes
data
,
int
elem_count
,
int
starting_position
):
cdef
inline
tuple
parse_list
(
bytes
data
,
int
elem_count
,
int
starting_position
):
"""
"""
Parse a list with this many elements
Parse a list with this many elements
...
@@ -120,8 +120,8 @@ cdef inline tuple parse_sdict(bytes data, int elem_count, int starting_position)
...
@@ -120,8 +120,8 @@ cdef inline tuple parse_sdict(bytes data, int elem_count, int starting_position)
return
offset
,
dct
return
offset
,
dct
cdef
bint
can_be_encoded_as_a_dict
(
dict
dct
):
cdef
inline
bint
can_be_encoded_as_a_dict
(
dict
dct
):
for
key
,
value
in
dct
.
item
s
():
for
key
in
dct
.
key
s
():
if
not
isinstance
(
key
,
str
):
if
not
isinstance
(
key
,
str
):
return
False
return
False
if
len
(
key
)
>
255
:
if
len
(
key
)
>
255
:
...
@@ -167,16 +167,13 @@ cpdef tuple parse(bytes data, int starting_position):
...
@@ -167,16 +167,13 @@ cpdef tuple parse(bytes data, int starting_position):
raise
DecodingError
(
'
Invalid UTF-8
'
)
from
e
raise
DecodingError
(
'
Invalid UTF-8
'
)
from
e
elif
value_type
&
0xF0
==
0x40
:
elif
value_type
&
0xF0
==
0x40
:
elements
=
value_type
&
0xF
elements
=
value_type
&
0xF
e_list
=
[]
string_length
,
e_list
=
parse_list
(
data
,
elements
,
starting_position
+
1
)
string_length
,
e_list
=
parse_list
(
data
,
elements
,
starting_position
+
1
)
return
string_length
+
1
,
e_list
return
string_length
+
1
,
e_list
elif
value_type
&
0xF0
==
0x50
:
elif
value_type
&
0xF0
==
0x50
:
e_dict
=
{}
elements
=
value_type
&
0xF
elements
=
value_type
&
0xF
offset
,
e_dict
=
parse_dict
(
data
,
elements
,
starting_position
+
1
)
offset
,
e_dict
=
parse_dict
(
data
,
elements
,
starting_position
+
1
)
return
offset
+
1
,
e_dict
return
offset
+
1
,
e_dict
elif
value_type
&
0xF0
==
0x60
:
elif
value_type
&
0xF0
==
0x60
:
e_dict
=
{}
elements
=
value_type
&
0xF
elements
=
value_type
&
0xF
offset
,
e_dict
=
parse_sdict
(
data
,
elements
,
starting_position
+
1
)
offset
,
e_dict
=
parse_sdict
(
data
,
elements
,
starting_position
+
1
)
return
offset
+
1
,
e_dict
return
offset
+
1
,
e_dict
...
@@ -212,7 +209,6 @@ cpdef tuple parse(bytes data, int starting_position):
...
@@ -212,7 +209,6 @@ cpdef tuple parse(bytes data, int starting_position):
return
2
,
sint8
return
2
,
sint8
elif
value_type
==
7
:
elif
value_type
==
7
:
elements
=
data
[
starting_position
+
1
]
elements
=
data
[
starting_position
+
1
]
e_list
=
[]
offset
,
e_list
=
parse_list
(
data
,
elements
,
starting_position
+
2
)
offset
,
e_list
=
parse_list
(
data
,
elements
,
starting_position
+
2
)
return
offset
+
2
,
e_list
return
offset
+
2
,
e_list
elif
value_type
==
8
:
elif
value_type
==
8
:
...
@@ -226,7 +222,6 @@ cpdef tuple parse(bytes data, int starting_position):
...
@@ -226,7 +222,6 @@ cpdef tuple parse(bytes data, int starting_position):
return
4
,
uint32
return
4
,
uint32
elif
value_type
==
11
:
elif
value_type
==
11
:
elements
=
data
[
starting_position
+
1
]
elements
=
data
[
starting_position
+
1
]
e_dict
=
{}
offset
,
e_dict
=
parse_dict
(
data
,
elements
,
starting_position
+
2
)
offset
,
e_dict
=
parse_dict
(
data
,
elements
,
starting_position
+
2
)
return
offset
+
2
,
e_dict
return
offset
+
2
,
e_dict
elif
value_type
==
13
:
elif
value_type
==
13
:
...
...
This diff is collapsed.
Click to expand it.
setup.cfg
+
1
−
1
View file @
c7f78a08
# coding:
utf-8
# coding:
utf-8
[metadata]
[metadata]
version
= 2.1rc
1
version
= 2.1rc
2
name
= minijson
name
= minijson
long-description
= file: README.md
long-description
= file: README.md
long-description-content-type
= text/markdown; charset=UTF-8
long-description-content-type
= text/markdown; charset=UTF-8
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment