-
Notifications
You must be signed in to change notification settings - Fork 230
Heap performance #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Heap performance #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,15 +30,20 @@ var dicomParser = (function (dicomParser) | |
| throw "dicomParser.parseDicomDataSetExplicit: invalid value for parameter 'maxPosition'"; | ||
| } | ||
| var elements = dataSet.elements; | ||
| var element; | ||
|
|
||
| while(byteStream.position < maxPosition) | ||
| { | ||
| var element = dicomParser.readDicomElementExplicit(byteStream, dataSet.warnings, options.untilTag); | ||
| element = dicomParser.readDicomElementExplicit(byteStream, dataSet.warnings, options.untilTag); | ||
| elements[element.tag] = element; | ||
| if(element.tag === options.untilTag) { | ||
| element = null; | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| delete element.tag; | ||
|
|
||
| if(byteStream.position > maxPosition) { | ||
| throw "dicomParser:parseDicomDataSetExplicit: buffer overrun"; | ||
| } | ||
|
|
@@ -64,15 +69,20 @@ var dicomParser = (function (dicomParser) | |
| } | ||
|
|
||
| var elements = dataSet.elements; | ||
| var element; | ||
|
|
||
| while(byteStream.position < maxPosition) | ||
| { | ||
| var element = dicomParser.readDicomElementImplicit(byteStream, options.untilTag, options.vrCallback); | ||
| element = dicomParser.readDicomElementImplicit(byteStream, options.untilTag, options.vrCallback); | ||
| elements[element.tag] = element; | ||
| if(element.tag === options.untilTag) { | ||
| element = null; | ||
| return; | ||
|
Comment on lines
+79
to
80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This clean-up is not needed as the whole closure is disposed of with the |
||
| } | ||
| } | ||
|
|
||
| delete element.tag; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why delete the |
||
|
|
||
| }; | ||
|
|
||
| return dicomParser; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,10 @@ var dicomParser = (function (dicomParser) { | |
| maxElementLength : 128 // maximum element length to try and convert to string format | ||
| }; | ||
|
|
||
| var result = { | ||
|
|
||
| }; | ||
| var result = {}; | ||
|
|
||
| for(var tag in dataSet.elements) { | ||
|
|
||
| var element = dataSet.elements[tag]; | ||
|
|
||
| // skip this element if it a private element and our options specify that we should | ||
|
|
@@ -42,21 +41,17 @@ var dicomParser = (function (dicomParser) { | |
| } | ||
| result[tag] = sequenceItems; | ||
| } else { | ||
| var asString; | ||
| asString = undefined; | ||
| if(element.length < options.maxElementLength) { | ||
| asString = dicomParser.explicitElementToString(dataSet, element); | ||
| } | ||
|
|
||
| if(asString !== undefined) { | ||
| result[tag] = asString; | ||
| } else { | ||
| result[tag] = { | ||
| dataOffset: element.dataOffset, | ||
| length : element.length | ||
| }; | ||
| result[tag] = dicomParser.explicitElementToString(dataSet, element); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will create entries with |
||
| if (result[tag] === undefined){ | ||
| result[tag] = { | ||
| dataOffset: element.dataOffset, | ||
| length : element.length | ||
| }; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| return result; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as in
parseDicomDataSetImplicit