This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Reduce startup cost of compiler (patch 1)
> On Mon, 23 Jul 2007, Jan Hubicka wrote:
>
> > with my changes it is now:
> > 248879 43.0979 no-vmlinux no-vmlinux (no symbols)
> > 17864 3.0935 cc1 cc1 ggc_alloc_stat
> > 11423 1.9781 libc-2.5.so libc-2.5.so memset
> > 11383 1.9712 cc1 cc1 new_convert_optab
> > 11063 1.9158 libc-2.5.so libc-2.5.so strlen
> > 9191 1.5916 cc1 cc1 free_binding_and_advance
> > 7912 1.3701 libc-2.5.so libc-2.5.so _int_malloc
> > 6654 1.1523 cc1 cc1 make_node_stat
> > 6482 1.1225 cc1 cc1 do_add
> > 5799 1.0042 cc1 cc1 tree_code_size
> > 5503 0.9529 cc1 cc1 do_multiply
> > 5154 0.8925 cc1 cc1 init_regs
> > 4969 0.8605 cc1 cc1 do_divide
> > 4501 0.7794 cc1 cc1 pop_scope
> > 4381 0.7587 cc1 cc1 ht_lookup_with_hash
> >
> > [...]
> > do_add and friends are caused by parsing incredibly long real numbers by incredibly slow
> > simulator in:
> > real_from_string (&dconstpi,
> > "3.1415926535897932384626433832795028841971693993751058209749445923078");
> > real_from_string (&dconste,
> > "2.7182818284590452353602874713526624977572470936999595749669676277241");
> > and friends. Perhaps this can be precomputed, but at least it is not dirtifying memory.
>
> The dconstpi doesn't exist in mainline. (Which gcc version were you
> testing with?) But it has been replaced by another one, dconstsqrt2.
>
> There's also a computation of dconstthird using dconst1/dconst3. I'm not
> sure if that div calcuation dominates the above profile of do_*, or it's
> really real_from_string for the above constants.
I cited from the old sources, but the tests was done on current
mainline. I remember the callstack going back to initialization of
emit-rtl.c. There are also some constants built by i386 that are quite
common.
Doing lazy initialization of those, if easilly doable, seems like good
idea to me.
Thanks,
Honza
>
> I think I can get rid of some or all of these dconst's, and/or use lazy
> evaluation so they're only computed if used. Would you like me to do
> that?
>
> --Kaveh
> --
> Kaveh R. Ghazi ghazi@caip.rutgers.edu