[LyX/master] Make cell index of tabular local for column loop.
Scott Kostyshak
skostysh at lyx.org
Thu Feb 13 18:03:00 UTC 2020
On Wed, Feb 12, 2020 at 05:05:25PM +0100, Pavel Sanda wrote:
> On Wed, Feb 12, 2020 at 08:50:13AM -0500, Scott Kostyshak wrote:
> > Is it true that without optimization, this change would be less
> > efficient because cell has to be recreated (so memory allocated) on each
> > iteration of the for loop? But is the idea that compilers recognize this
> > and only allocate memory once so that in practice there is no loss in
> > efficiency?
>
> I am no expert of what nowadays compilers do in backgrounds but if the variable
> was a simple type like integer then there is really no memory allocation
> business going on, because you are on stack. Stack pointer might decrease, that
> should be all.
> Contrary is the case when you get new variable on heap via new/malloc/...
>
> When the variable is class I can imagine things could go south when
> someone would define copy constructor and assignment operator with
> strikingly different semantics. But then again, the issue is not
> inherently with memory allocation per se...
Good to know. This gives me some things to think about and search for
more information if I want to follow-up on this (just as a motivating
reason to learn more about a couple of "lower level" topics in C++).
Thanks,
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200213/b1a5ef53/attachment.asc>
More information about the lyx-devel
mailing list