May 13, 2020 my blog on recent code and dmd performance tips | ||||
---|---|---|---|---|
| ||||
I try to write something on this once a week, though longer posts like this tend to be less common (and some weeks, like last week, I post nothing at all...), but I rarely post here since I don't want to be super spammy. However a reminder here my D blog is still active and if you use my libs you might want to check in once a month or so and if you don't, the general D tips are probably interesting enough for you to skim anyway every two or three months. Anyway, I wrote something longer this time and talked both about my libs and about some dmd compile speed/ram tips in general so might be worth a skim by many of you: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_05_11.html (and a couple weeks ago I wrote about the script lang too which if you are at all interested in that it might be fun to look at: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_04_27.html you can subclass D classes in script and reuse them from D! pretty cool if i do say so myself lol) |
May 13, 2020 Re: my blog on recent code and dmd performance tips | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Wednesday, 13 May 2020 at 01:57:18 UTC, Adam D. Ruppe wrote:
> I try to write something on this once a week, though longer posts like this tend to be less common (and some weeks, like last week, I post nothing at all...), but I rarely post here since I don't want to be super spammy.
>
> However a reminder here my D blog is still active and if you use my libs you might want to check in once a month or so and if you don't, the general D tips are probably interesting enough for you to skim anyway every two or three months.
>
> Anyway, I wrote something longer this time and talked both about my libs and about some dmd compile speed/ram tips in general so might be worth a skim by many of you:
>
> http://dpldocs.info/this-week-in-d/Blog.Posted_2020_05_11.html
>
> (and a couple weeks ago I wrote about the script lang too which if you are at all interested in that it might be fun to look at: http://dpldocs.info/this-week-in-d/Blog.Posted_2020_04_27.html you can subclass D classes in script and reuse them from D! pretty cool if i do say so myself lol)
Yah static foreach is slow for sure. Part of the problem is that it literally just runs a lambda at CTFE that creates a tuple. So that static foreach 0 .. 10000 literally creates a tuple with 10000 elements. Might even create an array first that then gets converted to that tuple. So yah, not very efficient at all.
|
Copyright © 1999-2021 by the D Language Foundation