Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Michal Malý
Molstar
Commits
f9154ab4
"src/mol-gl/shader/mesh.vert.ts" did not exist on "b8a4365dbe94f5a4cde816b90483860b9ebe70b2"
Commit
f9154ab4
authored
7 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
more chunker updates
parent
9890d480
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-util/computation.ts
+17
-3
17 additions, 3 deletions
src/mol-util/computation.ts
src/script.ts
+1
-1
1 addition, 1 deletion
src/script.ts
with
18 additions
and
4 deletions
src/mol-util/computation.ts
+
17
−
3
View file @
f9154ab4
...
@@ -221,7 +221,10 @@ class ChunkerImpl implements Computation.Chunker {
...
@@ -221,7 +221,10 @@ class ChunkerImpl implements Computation.Chunker {
private
updater
:
Computation
.
Context
[
'
update
'
];
private
updater
:
Computation
.
Context
[
'
update
'
];
private
computeChunkSize
(
delta
:
number
)
{
private
computeChunkSize
(
delta
:
number
)
{
if
(
!
delta
)
return
this
.
nextChunkSize
;
if
(
!
delta
)
{
this
.
processedSinceUpdate
=
0
;
return
this
.
nextChunkSize
;
}
const
rate
=
(
this
.
context
as
ObservableContext
).
updateRate
||
DefaulUpdateRateMs
;
const
rate
=
(
this
.
context
as
ObservableContext
).
updateRate
||
DefaulUpdateRateMs
;
const
ret
=
Math
.
round
(
this
.
processedSinceUpdate
*
rate
/
delta
+
1
);
const
ret
=
Math
.
round
(
this
.
processedSinceUpdate
*
rate
/
delta
+
1
);
this
.
processedSinceUpdate
=
0
;
this
.
processedSinceUpdate
=
0
;
...
@@ -241,23 +244,34 @@ class ChunkerImpl implements Computation.Chunker {
...
@@ -241,23 +244,34 @@ class ChunkerImpl implements Computation.Chunker {
async
process
(
nextChunk
:
(
size
:
number
)
=>
number
,
update
:
(
updater
:
Computation
.
Context
[
'
update
'
])
=>
Promise
<
void
>
|
void
,
nextChunkSize
?:
number
)
{
async
process
(
nextChunk
:
(
size
:
number
)
=>
number
,
update
:
(
updater
:
Computation
.
Context
[
'
update
'
])
=>
Promise
<
void
>
|
void
,
nextChunkSize
?:
number
)
{
if
(
typeof
nextChunkSize
!==
'
undefined
'
)
this
.
setNextChunkSize
(
nextChunkSize
);
if
(
typeof
nextChunkSize
!==
'
undefined
'
)
this
.
setNextChunkSize
(
nextChunkSize
);
this
.
processedSinceUpdate
=
0
;
// track time for the actual computation and exclude the "update time"
// track time for the actual computation and exclude the "update time"
let
chunkStart
=
Computation
.
now
();
let
chunkStart
=
Computation
.
now
();
let
lastChunkSize
:
number
;
let
lastChunkSize
:
number
;
let
chunkCount
=
0
;
let
totalSize
=
0
;
let
updateCount
=
0
;
while
((
lastChunkSize
=
nextChunk
(
this
.
getNextChunkSize
()))
>
0
)
{
while
((
lastChunkSize
=
nextChunk
(
this
.
getNextChunkSize
()))
>
0
)
{
chunkCount
++
;
this
.
processedSinceUpdate
+=
lastChunkSize
;
this
.
processedSinceUpdate
+=
lastChunkSize
;
totalSize
+=
lastChunkSize
;
if
(
this
.
context
.
requiresUpdate
)
{
if
(
this
.
context
.
requiresUpdate
)
{
let
time
=
Computation
.
now
();
let
time
=
Computation
.
now
();
await
update
(
this
.
updater
);
await
update
(
this
.
updater
);
this
.
nextChunkSize
=
this
.
computeChunkSize
(
time
-
chunkStart
);
this
.
nextChunkSize
=
updateCount
>
0
?
Math
.
round
((
totalSize
+
this
.
computeChunkSize
(
time
-
chunkStart
))
/
(
chunkCount
+
1
))
:
this
.
computeChunkSize
(
time
-
chunkStart
)
updateCount
++
;
chunkStart
=
Computation
.
now
();
chunkStart
=
Computation
.
now
();
}
}
}
}
if
(
this
.
context
.
requiresUpdate
)
{
if
(
this
.
context
.
requiresUpdate
)
{
let
time
=
Computation
.
now
();
let
time
=
Computation
.
now
();
await
update
(
this
.
updater
);
await
update
(
this
.
updater
);
this
.
nextChunkSize
=
this
.
computeChunkSize
(
time
-
chunkStart
);
this
.
nextChunkSize
=
updateCount
>
0
?
Math
.
round
((
totalSize
+
this
.
computeChunkSize
(
time
-
chunkStart
))
/
(
chunkCount
+
1
))
:
this
.
computeChunkSize
(
time
-
chunkStart
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/script.ts
+
1
−
1
View file @
f9154ab4
...
@@ -148,7 +148,7 @@ async function runCIF(input: string | Uint8Array) {
...
@@ -148,7 +148,7 @@ async function runCIF(input: string | Uint8Array) {
export
async
function
_cif
()
{
export
async
function
_cif
()
{
let
path
=
`./examples/1grm_updated.cif`
;
let
path
=
`./examples/1grm_updated.cif`
;
// path = '../test/3j3q.cif' // lets have a relative path for big test files
// path = '../test/3j3q.cif' // lets have a relative path for big test files
//path = 'e:/test/quick/3j3q_updated.cif';
//
path = 'e:/test/quick/3j3q_updated.cif';
const
input
=
await
readFileAsync
(
path
,
'
utf8
'
)
const
input
=
await
readFileAsync
(
path
,
'
utf8
'
)
console
.
log
(
'
------------------
'
);
console
.
log
(
'
------------------
'
);
console
.
log
(
'
Text CIF:
'
);
console
.
log
(
'
Text CIF:
'
);
...
...
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