tamer: tameld: Reduce peak memory usage
This clears the buffers used by quick_xml, which was apparently forgotten during initial development (I think I expected it to re-use the previously allocated space automatically). This has significant effects in some cases. For example, one of our UI builds drops from ~9KiB to ~5KiB peak memory usage. Other builds for larger suppliers are only slightly effected because of some of their massive fragments.main
parent
ce233ac01d
commit
d96dcad7d8
|
@ -24,6 +24,11 @@ Linker
|
||||||
------
|
------
|
||||||
- Remove exception for input map dependency processing (now that compiler no
|
- Remove exception for input map dependency processing (now that compiler no
|
||||||
longer emits such a dependency).
|
longer emits such a dependency).
|
||||||
|
- Reduce peak memory usage by clearing buffer of `xmlo` reader between
|
||||||
|
events.
|
||||||
|
- How effective this is varies depending on the size of individual
|
||||||
|
entities within the XML document. In some cases, it can reduce peak
|
||||||
|
memory usage by half.
|
||||||
|
|
||||||
|
|
||||||
v18.0.3 (2021-07-21)
|
v18.0.3 (2021-07-21)
|
||||||
|
|
|
@ -250,6 +250,11 @@ where
|
||||||
///
|
///
|
||||||
/// TODO: Augment failures with context
|
/// TODO: Augment failures with context
|
||||||
pub fn read_event<'a>(&mut self) -> XmloResult<XmloEvent<Ix>> {
|
pub fn read_event<'a>(&mut self) -> XmloResult<XmloEvent<Ix>> {
|
||||||
|
// Just to cut down on peak memory usage, cleaning up after a
|
||||||
|
// previous run. This does not affect behavior.
|
||||||
|
self.buffer.clear();
|
||||||
|
self.sub_buffer.clear();
|
||||||
|
|
||||||
let event = self.reader.read_event(&mut self.buffer)?;
|
let event = self.reader.read_event(&mut self.buffer)?;
|
||||||
|
|
||||||
// Ensure that the first encountered node is something we expect
|
// Ensure that the first encountered node is something we expect
|
||||||
|
|
Loading…
Reference in New Issue