Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #70257
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: issues with std::variant |
| Date | 2019-12-04 22:34 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <qs98p9$632$1@dont-email.me> (permalink) |
| References | <d24af259-867c-49b3-a747-e3d4e932ae4a@googlegroups.com> |
On 04/12/2019 17:37, wtholliday@gmail.com wrote: > I'm using std::variant in my code for one very important type > (`Node`). This variant has 68 different types in it. There are two > issues: > > 1. Compile times are extremely slow (~30s per file), due to variant > visitation. I'm an indie developer and I don't want to have to buy a > new computer (might only be a factor of two faster anyway). > There are many possibilities for speeding up compilation. But we'd need a lot more information to be able to tell. I can only give some vague suggestions (in no particular order), without knowing which might apply. 1. If your computer is very slow, get a better one - or upgrade the one you have (more memory is often helpful). 2. Consider changing compilers if the compiler is slow. 3. If you are working with lots of files in the project, make sure you are using a good build system with parallel builds. 4. If you have everything in a few huge files, split them up (and use a parallel build system). 5. If you are using Windows and have parallel builds and lots of files, especially with gcc or clang, try Linux. If you are stuck with Windows, try with an SSD instead of a hard disk. 6. Look at pre-compiled header support. 7. Check the compiler flags. You'll want some optimisation, but be careful about using some of the more powerful ones (especially ones that are not part of any -O option), as they can involve a great deal of compiler effort. But if you have no optimisation, the compiler will have to generate huge amounts of code, which can be slower than optimising. 8. Consider something other than variant. A variant needs quite a bit of compile-time effort to get its static type safety and convenience, and a 68 type variant is going to involve a very large amount of compile-time effort.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
issues with std::variant wtholliday@gmail.com - 2019-12-04 08:37 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-04 10:26 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 11:07 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-04 12:31 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 13:09 -0800
Re: issues with std::variant "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-04 22:39 +0100
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 16:18 -0800
Re: issues with std::variant "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-05 05:13 +0100
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 09:59 -0800
Re: issues with std::variant Christian Gollwitzer <auriocus@gmx.de> - 2019-12-06 09:39 +0100
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-06 09:12 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-04 14:46 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 16:28 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 00:00 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 00:48 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 08:17 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 09:44 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 11:14 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 12:37 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 13:20 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 13:42 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 15:41 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-06 09:44 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-07 04:43 -0800
Re: issues with std::variant Manfred <noname@add.invalid> - 2019-12-07 18:17 +0100
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-07 11:45 -0800
Re: issues with std::variant Christian Gollwitzer <auriocus@gmx.de> - 2019-12-06 09:58 +0100
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-06 06:06 -0800
Re: issues with std::variant David Brown <david.brown@hesbynett.no> - 2019-12-04 22:34 +0100
Re: issues with std::variant Vir Campestris <vir.campestris@invalid.invalid> - 2019-12-05 15:07 +0000
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 10:01 -0800
Re: issues with std::variant David Brown <david.brown@hesbynett.no> - 2019-12-05 22:15 +0100
csiph-web