Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
21496b3c
Verified
Commit
21496b3c
authored
May 30, 2019
by
Camil Staps
🐟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up jsDeserialize: don't copy string to JS first
parent
fa61ed6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
+15
-6
No files found.
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
View file @
21496b3c
...
...
@@ -79,10 +79,17 @@ const ABC={
var
max_words_needed
=
string
.
length
/
8
*
4
;
// rough upper bound
ABC
.
require_hp
(
max_words_needed
);
var
array
=
new
Int8Array
(
string
.
length
);
for
(
var
i
in
string
)
array
[
i
]
=
string
.
charCodeAt
(
i
);
var
graph
=
new
Uint32Array
(
array
.
buffer
);
var
graph
;
if
(
string
.
constructor
.
name
==
'
Uint32Array
'
)
{
graph
=
string
;
}
else
if
(
typeof
string
==
'
string
'
)
{
var
array
=
new
Uint8Array
(
string
.
length
);
for
(
var
i
=
0
;
i
<
string
.
length
;
i
++
)
array
[
i
]
=
string
.
charCodeAt
(
i
);
graph
=
new
Uint32Array
(
array
.
buffer
);
}
else
{
throw
new
ABCError
(
'
illegal argument type for ABC.deserialize()
'
);
}
var
unused_semispace
=
ABC
.
util
.
instance
.
exports
.
get_unused_semispace
();
for
(
var
i
=
0
;
i
<
graph
.
length
;
i
++
)
ABC
.
memory_array
[
unused_semispace
/
4
+
i
]
=
graph
[
i
];
...
...
@@ -481,8 +488,10 @@ ABC.loading_promise=fetch('js/app.pbc').then(function(resp){
ABC
.
memory_array
[
asp
/
4
]
=
ABC
.
shared_clean_values
[
index
].
ref
;
break
;
case
6
:
/* iTasks.UI.JS.Interface: deserialize */
var
string
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
]);
ABC
.
memory_array
[
asp
/
4
]
=
ABC
.
deserialize
(
string
);
var
hp_ptr
=
ABC
.
memory_array
[
asp
/
4
];
var
size
=
ABC
.
memory_array
[
hp_ptr
/
4
+
2
];
var
array
=
new
Uint32Array
(
ABC
.
memory
.
buffer
,
hp_ptr
+
16
,
size
/
4
);
ABC
.
memory_array
[
asp
/
4
]
=
ABC
.
deserialize
(
array
);
break
;
case
7
:
/* iTasks.UI.JS.Interface: initialize_client in wrapInitUIFunction */
var
array
=
ABC
.
memory_array
[
asp
/
4
]
+
24
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment