[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] [PATCH] Micro-optimization for ledger_format() taking vector
From: |
Vadim Zeitlin |
Subject: |
[lmi] [PATCH] Micro-optimization for ledger_format() taking vector |
Date: |
Thu, 29 Jun 2017 18:16:26 +0200 |
Hello,
While looking at this code, I couldn't help noticing that ledger_format()
makes a copy of all vectors passed to it, which seems completely
unnecessary -- even if these vectors are not exactly huge (limited to ~100
elements, I think), there is a number of them and just avoid a ~100
allocations is, I believe, worth it, especially when it can be avoided by
simply passing the vector by const reference instead of by value, so I went
ahead and made this change and also another small one inside the function
itself to avoid more memory (re)allocations there, please see
https://github.com/vadz/lmi/pull/58/files
This is not urgent at all, but OTOH it's a very simple change and so it
shouldn't take you long to merge it.
Thanks in advance,
VZ
- [lmi] [PATCH] Micro-optimization for ledger_format() taking vector,
Vadim Zeitlin <=