nrkno / sofie-emberplus-connection

Ember+ Connection: A Part of the Sofie TV Studio Automation System
https://github.com/nrkno/Sofie-TV-automation/
MIT License
20 stars 15 forks source link

feat: remove creation of a new reader for each sequence tag #13

Closed sparkpunkd closed 4 years ago

sparkpunkd commented 4 years ago

Based on what I believe was a misunderstanding of how the ASN.1 library works, the decoder was creating a new Ber.Reader for every sequence tag. This is not necessary when the decoder is reading linearly from start to finish. I have removed the ExtendedReader.getSequence() method and replaced this with the intended use of ASN.1 via readSequence() and reader.length.

For large structures, this may improve performance because it significantly reduces the number of objects created and the amount of garbage that needs to be collected.