Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iTasks-SDK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
73
Issues
73
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
979683c1
Verified
Commit
979683c1
authored
May 30, 2019
by
Camil Staps
🚀
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up jsDeserialize (again; see
74749311
): don't copy at all but overwrite source string
parent
23c58481
Pipeline
#24183
failed with stage
in 1 minute and 4 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
31 deletions
+36
-31
Libraries/iTasks/Extensions/SVG/SVGEditor.icl
Libraries/iTasks/Extensions/SVG/SVGEditor.icl
+7
-3
Libraries/iTasks/UI/JavaScript.dcl
Libraries/iTasks/UI/JavaScript.dcl
+1
-1
Libraries/iTasks/UI/JavaScript.icl
Libraries/iTasks/UI/JavaScript.icl
+2
-2
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
+26
-25
No files found.
Libraries/iTasks/Extensions/SVG/SVGEditor.icl
View file @
979683c1
...
...
@@ -160,10 +160,14 @@ toUIAttributes attr vst
#
(
attr
,
vst
)
=
serializeForClient
attr
vst
=
('
Data
.
Map
'.
fromList
[(
JS_ATTR_SVG
,
JSONString
attr
)],
vst
)
fromUIAttributes
::
!
String
!*
JSWorld
->
(!
ServerToClientAttr
s
,!*
JSWorld
)
fromUIAttributes
::
!
*
String
!*
JSWorld
->
(!
ServerToClientAttr
s
,!*
JSWorld
)
fromUIAttributes
json
world
=
jsDeserializeGraph
json
world
ensure_uniqueness
::
!
String
->
*
String
ensure_uniqueness
_
=
code {
no_op
}
// the server side state:
::
ServerSVGState
s
...
...
@@ -367,7 +371,7 @@ clientGetTaskId me world
clientInitDOMEl
::
!(
SVGEditor
s
v
)
!
JSVal
!{!
JSVal
}
!*
JSWorld
->
*
JSWorld
|
JSONEncode
{|*|}
s
clientInitDOMEl
svglet
me
args
world
#!
(
model
,
world
)
=
me
.#
"attributes.value"
.?
world
#!
(
model
,
world
)
=
jsDeserializeGraph
(
jsValToString`
""
model
)
world
#!
(
model
,
world
)
=
jsDeserializeGraph
(
ensure_uniqueness
(
jsValToString`
""
model
)
)
world
#!
(
jsView
,
world
)
=
jsMakeCleanReference
(
svglet
.
initView
model
)
me
world
#!
(
jsModel
,
world
)
=
jsMakeCleanReference
model
me
world
#!
world
=
(
me
.#
JS_ATTR_VIEW
.=
jsView
)
world
...
...
@@ -388,7 +392,7 @@ clientHandleAttributeChange svglet me args world
#!
world
=
timeTrace
(
"clientHandleAttributeChange ["
+++
join
","
(
map
fst
nv_pairs
)
+++
"] started at "
)
world
=
case
svg_or_text
of
Just
json
#!
(
request
,
world
)
=
fromUIAttributes
(
jsValToString`
""
json
)
world
#!
(
request
,
world
)
=
fromUIAttributes
(
ensure_uniqueness
(
jsValToString`
""
json
)
)
world
=
case
request
of
(
ServerNeedsTextMetrics
new_fonts
new_texts
)
#!
world
=
timeTrace
"clientHandleAttributeChange (ServerNeedsTextMetrics) started at "
world
...
...
Libraries/iTasks/UI/JavaScript.dcl
View file @
979683c1
...
...
@@ -208,7 +208,7 @@ wrapInitUIFunction :: !(JSVal *JSWorld -> *JSWorld) -> {!JSVal} -> *JSWorld -> *
* @param The string to deserialize.
* @result The deserialized value.
*/
jsDeserializeGraph
::
!
String
!*
JSWorld
->
*(!.
a
,
!*
JSWorld
)
jsDeserializeGraph
::
!
*
String
!*
JSWorld
->
*(!.
a
,
!*
JSWorld
)
/**
* Load external CSS stylesheet by its URL.
...
...
Libraries/iTasks/UI/JavaScript.icl
View file @
979683c1
...
...
@@ -552,10 +552,10 @@ where
repl_r_args
0
1
}
jsDeserializeGraph
::
!
String
!*
JSWorld
->
*(!.
a
,
!*
JSWorld
)
jsDeserializeGraph
::
!
*
String
!*
JSWorld
->
*(!.
a
,
!*
JSWorld
)
jsDeserializeGraph
s
w
=
(
deserialize
s
,
w
)
where
deserialize
::
!
String
->
.
a
deserialize
::
!
*
String
->
.
a
deserialize
_
=
code {
instruction
6
}
...
...
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
View file @
979683c1
...
...
@@ -75,29 +75,11 @@ const ABC={
}
},
deserialize
:
function
(
string
)
{
var
max_words_needed
=
string
.
length
/
8
*
4
;
// rough upper bound
ABC
.
require_hp
(
max_words_needed
);
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
];
_deserialize
:
function
(
addr
,
size
)
{
var
old_hp
=
ABC
.
interpreter
.
instance
.
exports
.
get_hp
();
var
new_hp
=
ABC
.
util
.
instance
.
exports
.
copy_from_string
(
unused_semispace
,
graph
.
length
/
2
,
addr
,
size
,
ABC
.
interpreter
.
instance
.
exports
.
get_asp
()
+
8
,
ABC
.
interpreter
.
instance
.
exports
.
get_bsp
()
-
8
,
old_hp
,
...
...
@@ -110,7 +92,28 @@ const ABC={
ABC
.
interpreter
.
instance
.
exports
.
set_hp_free
(
new_hp_free
);
return
ABC
.
memory_array
[
unused_semispace
/
4
];
return
ABC
.
memory_array
[
addr
/
4
];
},
deserialize_from_unique_string
:
function
(
str_ptr
)
{
var
size
=
ABC
.
memory_array
[
str_ptr
/
4
+
2
];
ABC
.
require_hp
(
size
/
8
*
4
);
// rough upper bound
return
ABC
.
_deserialize
(
str_ptr
+
16
,
size
/
8
);
},
deserialize
:
function
(
string
)
{
var
max_words_needed
=
string
.
length
/
8
*
4
;
// rough upper bound
ABC
.
require_hp
(
max_words_needed
);
var
array
=
new
Uint8Array
(
string
.
length
);
for
(
var
i
=
0
;
i
<
string
.
length
;
i
++
)
array
[
i
]
=
string
.
charCodeAt
(
i
);
var
graph
=
new
Uint32Array
(
array
.
buffer
);
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
];
return
ABC
.
_deserialize
(
unused_semispace
,
graph
.
length
/
2
);
},
interpret
:
null
,
...
...
@@ -493,9 +496,7 @@ ABC.loading_promise=fetch('js/app.pbc').then(function(resp){
break
;
case
6
:
/* iTasks.UI.JS.Interface: deserialize */
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
);
ABC
.
memory_array
[
asp
/
4
]
=
ABC
.
deserialize_from_unique_string
(
hp_ptr
);
break
;
case
7
:
/* iTasks.UI.JS.Interface: initialize_client in wrapInitUIFunction */
var
array
=
ABC
.
memory_array
[
asp
/
4
]
+
24
;
...
...
Peter Achten
@peter88
mentioned in commit
858eb665
·
May 31, 2019
mentioned in commit
858eb665
mentioned in commit 858eb665e30ffff527362275f355a0ae4ecef8b4
Toggle commit list
Peter Achten
@peter88
mentioned in commit
206c53be
·
Jun 14, 2019
mentioned in commit
206c53be
mentioned in commit 206c53bebbf5fe836d69616c045d63b4a5b957ef
Toggle commit list
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