This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch 3/N] std::regex refactoring - _Executor DFS / BFS
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen91 at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Apr 2014 20:10:27 +0100
- Subject: Re: [patch 3/N] std::regex refactoring - _Executor DFS / BFS
- Authentication-results: sourceware.org; auth=none
- References: <20140428124003 dot GW928 at redhat dot com> <20140428144659 dot GY928 at redhat dot com> <CAPrifD=Bc4D63KJONG5d7YzX1t73HDm276AKPY5mEOZi942_EA at mail dot gmail dot com> <20140428165121 dot GB928 at redhat dot com> <CAPrifDnRhfm2pCDAN5fRs81g8m45u8Kt40n8NHXLmGJrh8aiOA at mail dot gmail dot com>
On 28/04/14 15:02 -0400, Tim Shen wrote:
If we want to change it to a runtime flag, it should be a class
member. Otherwise we have to pass it as a function parameter all the
time, and it may waste an instruction and one byte per recursive call.
It surely make the code cleaner.
Data members are accessed through the 'this' pointer, which can
require an indirection and be harder to optimise than a function
parameter.
Am I premature optimizing?
I don't know yet - we need to measure.
My concern is that making it a template parameter causes twice as much
code to be instantiated, which makes executables bigger and can cause
more I-cache misses.