On Wednesday, 14 February 2024 at 00:56:21 UTC, Kevin Bailey
wrote:
Personally, I don't have a problem with .length being unsigned.
How do you have a negative length? My problem is that the
language doesn't correctly compare signed and unsigned.
The length itself is technically the index of a
On Thursday, 18 January 2024 at 02:55:37 UTC, zjh wrote:
Can you change the type of 'length' from 'ulong' to 'int', so I
haven't to convert it every time!
The explicit conversion `.length.to!int` has an extra benefit of
doing a runtime check to ensure that the length value actually
fits in
On Sunday, 31 December 2023 at 14:47:27 UTC, Alexandru Ermicioi
wrote:
`CheckedInt` should be another solution for overflows, if you
really need it to throw exceptions, on overflow errors.
CheckedInt is worse than nothing. It exists to give an illusion
of having at least something to address
On Wednesday, 24 January 2024 at 09:28:57 UTC, Renato wrote:
If you have "widespread" arithmetics which may overflow,
something like https://dlang.org/phobos/core_checkedint.html is
useful, yes, but in this case it's overkill.
To make use of this, one needs to already anticipate an
On Tuesday, 23 January 2024 at 21:40:46 UTC, Renato wrote:
While I can understand your frustration, it seems to me D is
not to blame in this instance because the code is quite
patently using unsafe constructs
I wouldn't blame bachmeier, because many reduced testcases
distilled from the real
On Monday, 22 January 2024 at 01:14:06 UTC, Steven Schveighoffer
wrote:
On Sunday, 21 January 2024 at 16:05:40 UTC, Gavin Gray wrote:
The following code:
ulong charlie = 11;
long johnstone = std.algorithm.comparison.max(0, -charlie);
writeln(format!"johnstone %s"(johnstone));
Results in
On Monday, 22 January 2024 at 16:39:10 UTC, Nick Treleaven wrote:
Memory safety issues are a worse class of bug than arithmetic
bugs. The latter are reproducible if you feed them the same
input.
Memory safety bugs are reproducible with the tools like
`valgrind`. Whereas arithmetic overflow
On Saturday, 20 January 2024 at 01:27:50 UTC, H. S. Teoh wrote:
On Sat, Jan 20, 2024 at 01:35:44AM +0100, Daniel Kozak via
Digitalmars-d-learn wrote: [...]
> Try addressing the points I wrote above and see if it
makes a
> difference.
I have tried it (all of it) even before you wrote
On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
For the record (I already posted this on GitHub)... here's [my
current fastest
solution](https://github.com/renatoathaydes/prechelt-phone-number-encoding/blob/dlang-key-hash-incremental/src/d/src/dencoder.d) time using the same
On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
I can't explain why it's so incredibly fast, specially for the
`count` case. I tried using the same hashing function on my
solution, but that didn't really help me!
That's dynamic programming with memoization. Basically caching
the
On Tuesday, 16 January 2024 at 15:50:35 UTC, H. S. Teoh wrote:
Unfortunately there seems to be some discrepancy between the
output I got and the prescribed output in your repository. For
example, in your output the number 1556/0 does not have an
encoding, but isn't "1 Mai 0" a valid encoding
On Tuesday, 9 January 2024 at 21:30:06 UTC, Alexibu wrote:
If each works, I can't see why map filter etc can't work
consistently where they only need an input range.
```d
auto line = arr.filter!(a > 0).map!(a =>
a.to!string).joiner("\t").text;
```
Should be fine because each result range is
On Sunday, 31 December 2023 at 09:47:27 UTC, Siarhei Siamashka
wrote:
On Saturday, 30 December 2023 at 13:25:00 UTC, Christian
Köstlin wrote:
The "original"
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter_map works with the Option(Some/None) ...
Here's an example with
On Saturday, 30 December 2023 at 13:25:00 UTC, Christian Köstlin
wrote:
On Saturday, 30 December 2023 at 01:22:31 UTC, Siarhei
Siamashka wrote:
On Friday, 29 December 2023 at 23:10:47 UTC, Christian Köstlin
wrote:
Is there a way to implement filterMap (meaning do mapping of
a range, but if
On Friday, 29 December 2023 at 23:10:47 UTC, Christian Köstlin
wrote:
Is there a way to implement filterMap (meaning do mapping of a
range, but if something happens during the map, leave this
element out of the resulting range).
It's probably not a good idea to do this in general. Expecting a
On Sunday, 3 December 2023 at 15:04:09 UTC, Siarhei Siamashka
wrote:
On Saturday, 2 December 2023 at 14:35:19 UTC, Sergey wrote:
Some other solutions that could be worth to check:
https://github.com/andrewlalis/AdventOfCode2023/blob/main/day_1/solution.d
On Wednesday, 13 December 2023 at 19:51:11 UTC, Adam D Ruppe
wrote:
On Wednesday, 13 December 2023 at 19:37:09 UTC, Siarhei
Siamashka wrote:
Now I'm curious. Is it possible to somehow communicate the
real source file name to `dmd`, so that it shows up in the
error log instead of "__stdin.d"?
Example:
```D
import std;
void main() {
deliberate syntax error here
}
```
```bash
$ cat example.d | dmd -run -
__stdin.d(3): Error: found `error` when expecting `;` or `=`, did
you mean `deliberate syntax = here`?
__stdin.d(3): Error: found `}` when expecting `;` or `=`, did you
mean
On Sunday, 3 December 2023 at 18:56:32 UTC, Johannes Miesenhardt
wrote:
On Sunday, 3 December 2023 at 14:51:37 UTC, Siarhei Siamashka
wrote:
[...]
Thanks, this is super helpful. I have one other question, in
the solution you posted and also the one I posted in the
discord today. I was
On Monday, 4 December 2023 at 03:07:07 UTC, matheus wrote:
import std.stdio;
import std.algorithm;
import std.array;
import std.format;
import std.conv;
import std.string;
...
Why do you do multiple imports instead of one import std;?
I means is there any difference in CT?
The code indeed
On Saturday, 2 December 2023 at 14:35:19 UTC, Sergey wrote:
Some other solutions that could be worth to check:
https://github.com/andrewlalis/AdventOfCode2023/blob/main/day_1/solution.d
https://github.com/schveiguy/adventofcode/blob/master/2023/day1/trebuchet.d
It's indeed a good idea to have
On Saturday, 2 December 2023 at 13:33:33 UTC, Johannes
Miesenhardt wrote:
I am a bloody beginner so if there are any things that are very
wrong with this please point them out.
Everything is fine as long as it works and does the job.
The fact that I need a template for accepting both a string
On Friday, 24 November 2023 at 09:35:00 UTC, BoQsc wrote:
I tried to look into https://dlang.org/phobos/std_conv.html
Most of the functions inside `std.conv` seem to be dependant on
[Garbage Collection](https://dlang.org/spec/garbage.html).
And I couldn't find a straightforward way to
On Thursday, 2 February 2023 at 10:47:19 UTC, Salih Dincer wrote:
It can be seen below that the structure (LimitedArray)
implemented with
union is at least 15 times and at most 20 times faster.
Except that it isn't. How did you manage to get such ridiculous
results? Even running your program
On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote:
Greetings,
for an array byte[3][3] myArr, I can code myArr[0] = 5 and have:
5,5,5
0,0,0
0,0,0
Can I perform a similar assignment to the column? This,
myArr[][0] = 5, doesn't work.
This works fine for small arrays, but for large
On Wednesday, 18 January 2023 at 11:10:01 UTC, matheus wrote:
On Wednesday, 18 January 2023 at 01:05:58 UTC, Siarhei
Siamashka wrote:
On Tuesday, 17 January 2023 at 23:27:03 UTC, matheus wrote:
I ran in two sites: https://onecompiler.com/d and then
https://godbolt.org/, with the latter I set
On Tuesday, 17 January 2023 at 23:27:03 UTC, matheus wrote:
I ran in two sites: https://onecompiler.com/d and then
https://godbolt.org/, with the latter I set LDC with -O2.
My version (Source in the end) ran about 2x faster than the
version with ranges.
Well, the use of ranges is not the
On Tuesday, 17 January 2023 at 21:50:06 UTC, matheus wrote:
Question: Have you compared the timings between this way (With
ranges) and a normal way (Without ranges)?
If you are intensively using ranges, UFCS or the other convenient
high level language features, then the compiler choice does
On Tuesday, 10 January 2023 at 00:17:18 UTC, Paul wrote:
I was wondering if anyone knew of any coding challenges
available where the input and output are specified and its left
to the programmer to find a solution? Free would be nice but
even paid services would be worth considering. I'm
On Saturday, 24 December 2022 at 17:55:11 UTC, jwatson-CO-edu
wrote:
On Saturday, 24 December 2022 at 16:42:36 UTC, Siarhei
Siamashka wrote:
Sounds like a case of https://xkcd.com/221/
BTW, you don't need to explicitly initialize unpredictableSeed,
Another thing is that the current
On Saturday, 24 December 2022 at 16:16:17 UTC, jwatson-CO-edu
wrote:
Then it became clear that the parser was replacing calls to
`rand` with
a number, which was displayed repeatedly when a loop was
evaluated.
Sounds like a case of https://xkcd.com/221/
BTW, you don't need to explicitly
On Thursday, 22 December 2022 at 15:32:28 UTC, Anonymouse wrote:
I'm not sure what to do.
If it links on Ubuntu, but not on Manjaro/Arch, then is it
possible that the GDC package from Manjaro/Arch is somehow
provided with a missing, misconfigured or broken Phobos library?
Maybe try to
On Thursday, 8 December 2022 at 14:28:02 UTC, johannes wrote:
doing the following : (sqlite3 version 340)
gcc -E -dD sqlite3ext.h > sqlite3ext.i
dstep sqlit3ext.i -o/we/sqlite3/package.d
when compiling a program using this interface (import
we.sqlite3), I receive Errors like :
[...]
On Monday, 12 December 2022 at 06:02:27 UTC, Ferhat Kurtulmuş
wrote:
https://rosettacode.org/wiki/Bitmap/Flood_fill
The https://rosettacode.org/wiki/Bitmap/Flood_fill#D looks like a
DFS implementation. The end result is the same, but the order in
which the pixels to fill are reached is
On Sunday, 11 December 2022 at 06:50:44 UTC, Joel wrote:
I've been trying to fill in areas with a colour but can't work
it out. I want something like the effect where it fills with
diamonds. Not all at once but building up in the main program
loop.
I'm not sure if I understood the question
On Tuesday, 6 December 2022 at 23:07:32 UTC, johannes wrote:
//-- the result should be f.i. "the sun is shining"
//-- sqlite3_column_text returns a constant char* a \0
delimited c-string
printf("%s\n",sqlite3_column_text(res, i));
writeln(sqlite3_column_text(res, i));
On Sunday, 4 December 2022 at 12:37:08 UTC, Adam D Ruppe wrote:
All of the top 5 most popular libraries on code.dlang.org
embrace the GC.
Do you mean the top of the
https://code.dlang.org/?sort=score=library list?
How do you know that they embrace GC? Is it possible to filter
packages in
On Wednesday, 30 November 2022 at 03:19:49 UTC, Basile B. wrote:
writeln((30LU + 30LU) % uint.max);
It's actually
writeln((30LU + 30LU) % (uint.max.to!ulong +
1));
or
writeln((30LU + 30LU) & uint.max);
On Wednesday, 30 November 2022 at 00:40:57 UTC, Vladimir
Panteleev wrote:
On Tuesday, 29 November 2022 at 18:59:46 UTC, DLearner wrote:
Suggestion: it would be clearer if the two concepts were
separated:
1. Convert 'int[] VarArr;' so it produces a straightforward
_value-type_ variable array,
On Tuesday, 29 November 2022 at 23:25:46 UTC, DLearner wrote:
Many languages also have variable length arrays, I suggest D's
'dynamic array' _does not_ operate as expected.
I'm not suggesting that the result contradicts D's definition
of 'dynamic array', nor it's implementation, just that
On Monday, 21 November 2022 at 23:41:22 UTC, thebluepandabear
wrote:
But why give a C++ code example? 廊
It's a D code example and it even can't be compiled by a C++
compiler. Just add the missing main function:
```D
void main()
{
shared c = new Counter;
c.incrementCounter;
c.count =
On Sunday, 20 November 2022 at 12:23:39 UTC, Ali Çehreli wrote:
On 11/20/22 00:31, [] () {} () wrote:
> If anyone wants to learn more about why encapsulated types
> (classes) have shown to be so useful in my many years of
programming,
Hm. 'private' is about access control. Encapsulation is
On Tuesday, 15 November 2022 at 23:27:07 UTC, Siarhei Siamashka
wrote:
For doing a fast insert into an already sorted array (and
avoiding duplicated values) it's probably better to do
something like this:
```D
bool fast_insert_into_a_sorted_array(alias less = "a < b",
T)(ref T[] a, T value)
On Tuesday, 15 November 2022 at 20:09:40 UTC, Per Nordlöw wrote:
I wanted a sorted array because I want to include it in a
benchmark suite and study it's time and space complexity. No
application yet.
For doing a fast insert into an already sorted array (and
avoiding duplicated values) it's
On Tuesday, 15 November 2022 at 22:32:56 UTC, Per Nordlöw wrote:
Still, does anybody understand why the line
https://github.com/nordlow/phobos-next/blob/master/src/nxt/sorted.d#L52 fails to compile
Maybe add two typeof arguments?
```D
completeSort!(less, ss, typeof(_source),
On Tuesday, 15 November 2022 at 13:16:18 UTC, Paul Backus wrote:
D's safety model is the same. In `@safe` code, D will reject
anything that the compiler cannot say for sure is memory safe.
However, unlike in Rust, `@safe` is not the default in D, so
you must mark your code as `@safe` manually
On Tuesday, 15 November 2022 at 06:44:16 UTC, Ali Çehreli wrote:
In summary, you are right but the compiler cannot do anything
about it in all cases and we wouldn't want it to spend infinite
amount of time to try to determine everything.
Well, there's another way to look at it:
On Tuesday, 15 November 2022 at 03:05:30 UTC, Elfstone wrote:
So the compiler detects escaping in foo() but not in bar(),
this doesn't look right.
The compiler can detect it with -dip1000 command line option.
Is there a way to tell whether a slice is from a dynamic array
or a static array?
On Tuesday, 15 November 2022 at 02:26:41 UTC, Elfstone wrote:
By assigning aSlice to arr or a, it seemingly escapes the
scope, I thought there'd be errors, but the code compiles just
fine.
Is it really safe though?
No, it's not safe. You can add `@safe:` line in the beginning of
your
On Monday, 14 November 2022 at 00:29:40 UTC, Tejas wrote:
He said on Discord he want contiguous data structure, rbtree
allocates too much
OK, I guess this person got their question answered on Discord
and does not need any further assistance.
On Saturday, 12 November 2022 at 14:07:46 UTC, Per Nordlöw wrote:
Have anybody created a wrapper container
```d
struct Sorted(ArrayLike, alias lessThanPred)
```
that wraps an array-like type `ArrayLike` so that it's always
sorted according to the binary predicate `lessThanPred`?
I'm not
On Sunday, 13 November 2022 at 15:45:40 UTC, DLearner wrote:
```D
struct test_struct {
char[] Txt;
}
test_struct[] A;
auto B = A.dup;
```
But A is not an `int[]` in your new example. You need a "deep
copy" and I can see that similar questions had been asked in this
forum
On Sunday, 13 November 2022 at 14:28:45 UTC, DLearner wrote:
Creating a step 1.5:
```
int[] B = A;
```
```D
auto B = A.dup;
```
This will create a copy of A rather than referencing to the same
buffer in memory.
On Thursday, 3 November 2022 at 05:10:06 UTC, matheus wrote:
https://dlang.org/spec/class.html
Thanks for the link and also thanks for confirming that you have
no clue what's going on. I think that what actually happens is
that the D code
```D
A a2;
a2.foo();
```
is roughly equivalent
C++ code:
```C++
#include
class A {
public:
void foo() { std::cout << "foo" << std::endl; }
};
int main() {
auto a1 = new A;
a1->foo(); // prints "foo"
A a2;
a2.foo(); // prints "foo"
delete a1;
}
```
D code:
```D
@safe:
import std.stdio;
class A {
void foo() { writeln("foo"); }
}
On Friday, 28 October 2022 at 09:48:14 UTC, ab wrote:
Thanks to H.S. Teoh and Dennis for the suggestions, they both
work. I like the empty asm block a bit more because it is less
invasive, but it only works with ldc.
I used the volatileLoad/volatileStore functions to ensure that
the compiler
On Wednesday, 26 October 2022 at 06:05:14 UTC, Ali Çehreli wrote:
The problem with Unicode is its main aim of allowing characters
of multiple writing systems in the same text. When multiple
writing systems are in play, conflicts and ambiguities will
appear.
I personally don't think that it's
On Wednesday, 26 October 2022 at 05:17:06 UTC, rikki cattermole
wrote:
if you are able to ignore that Unicode is a thing, I'd
recommend it. It is complicated, as we humans are very
complicated ;)
I can't ignore Unicode, because I frequently have to deal with
Cyrillic alphabet ;) Also Unicode
On Tuesday, 25 October 2022 at 06:32:00 UTC, rikki cattermole
wrote:
On 25/10/2022 5:17 PM, Siarhei Siamashka wrote:
What are the best practices to deal with Turkish text in D
language?
std.uni doesn't support it.
OK, I'm not specifically interested in this personally and I even
would be
On Thursday, 13 October 2022 at 08:27:17 UTC, bauss wrote:
```d
bool isearch(S1, S2)(S1 haystack, S2 needle)
{
import std.uni;
import std.algorithm;
return haystack.asLowerCase.canFind(needle.asLowerCase);
}
```
untested.
-Steve
This doesn't actually work properly in all
On Friday, 21 October 2022 at 22:03:53 UTC, Kevin Bailey wrote:
I'm trying to do this equivalent C++:
unordered_map map;
for (auto i = map.find(something); i != map.end(); ++i)
...do something with i...
in D, but obviously with an associative array. It seems that
it's quite
On Tuesday, 18 October 2022 at 11:56:30 UTC, Yura wrote:
```D
// Then for each Sphere, i.e. dot[i]
// I need to do some arithmetics with itself and other dots
// I have only parallelized the inner loop, i is fixed.
It's usually a much better idea to parallelize the outer loop.
Even OpenMP
On Monday, 17 October 2022 at 20:22:47 UTC, jmh530 wrote:
If you have a problem with support for mir, submit a bug
report. I don't think gdc is supported, but ldc should be.
GDC12 has finally upgraded its D language frontend version to
2.100 and I have successfully compiled a simple lubeck
On Monday, 17 October 2022 at 20:05:24 UTC, mw wrote:
On Monday, 17 October 2022 at 19:54:12 UTC, Yura wrote:
it is possible to install the most recent ldc and gdc
compilers on Ubuntu 18.04?
Yes, I used LDC on the same system.
What's the recommended way to have up to date D compilers in
On Friday, 14 October 2022 at 21:38:45 UTC, Yura wrote:
in the top of my el.d file I have:
```D
/+dub.sdl:
dependency "mir-algorithm" version="~>3.16.12"
+/
import std.stdio;
import std.string;
import std.conv;
import std.exception : assertThrown;
import std.math;
import mir.ndslice;
```
On Friday, 14 October 2022 at 17:41:42 UTC, Yura wrote:
I am working under Ubuntu 18.04 and compiling my code like "gdc
solv.d"
That's an old distribution released 4 years ago and already
approaching its End of Standard Support in a few months (April
2023). This distribution offers old
On Saturday, 8 October 2022 at 01:07:46 UTC, rassoc wrote:
On 10/8/22 00:50, Siarhei Siamashka via Digitalmars-d-learn
wrote:
On Friday, 7 October 2022 at 12:19:59 UTC, bachmeier wrote:
python -c "print(('a' * 49 + 'b') * 2)" > test.lst
That's generating a file with a single
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote:
Has anyone experienced such problem before?
any suggestions where I should look at?
If you are compiling your program with "-release" command line
option, then arrays bounds checking is not done in the @system
code at all (which is all of
On Friday, 7 October 2022 at 12:19:59 UTC, bachmeier wrote:
https://www.cs.utexas.edu/users/moore/best-ideas/string-searching/
"the longer the pattern is, the faster the algorithm goes"
Yes, that's how substring search works in the standard libraries
of the other programming languages. Now
On Friday, 7 October 2022 at 06:34:50 UTC, Siarhei Siamashka
wrote:
Also are we allowed to artificially construct needle and
haystack to blow up this test rather than only benchmarking it
on typical real data?
Such as generating the input data via running:
python -c "print(('a' * 49 +
On Friday, 7 October 2022 at 00:57:38 UTC, rassoc wrote:
On 10/7/22 01:39, torhu via Digitalmars-d-learn wrote:
regex is about ten times faster then.
Interesting! Using your code, I'm seeing a 1.5x max difference
for ldc, nothing close to 10x. Welp, the woes of superficial
benchmarking. :)
On Wednesday, 5 October 2022 at 21:50:32 UTC, torhu wrote:
I did some basic testing, and regex was two orders of magnitude
faster. So now I know, I guess.
Substring search functionality is currently in a very bad shape
in Phobos. I discovered this myself a few weeks ago when I was
trying to
On Tuesday, 12 July 2022 at 13:23:36 UTC, ryuukk_ wrote:
I wonder if DMD/LDC/GDC have built in tools to profile and
track performance
Linux has a decent system wide profiler:
https://perf.wiki.kernel.org/index.php/Main_Page
And there are other useful tools, such as callgrind. To take
On Tuesday, 12 July 2022 at 07:58:44 UTC, bauss wrote:
You don't think this difference is huge? DMD is over 2x as fast.
I think that DMD having more than 10x faster compilation speed in
ryuukk_'s project shows that there is likely either a
misconfiguration in DUB build setup or some other
On Monday, 11 July 2022 at 22:16:05 UTC, ryuukk_ wrote:
LDC clean full rebuild
```
$ time dub build -f --compiler=ldc2
Performing "debug" build using ldc2 for x86_64.
game ~master: building configuration "desktop"...
Linking...
real0m18.033s
user0m0.000s
sys 0m0.015s
```
DMD clean
On Monday, 11 July 2022 at 22:16:05 UTC, ryuukk_ wrote:
I use D because DMD compiles my huge project in ~1 second (full
clean rebuild)
It is a competitive advantage that many languages doesn't have
The other programming languages typically use an interpreter for
quick iterations and rapid
On Tuesday, 17 May 2022 at 11:36:21 UTC, Adam D Ruppe wrote:
Oh I should have checked my impl, where I did all this already!
https://github.com/adamdruppe/webassembly/blob/master/arsd-webassembly/object.d#L263
Looks like you forgot to increment the pointer and need "*d++ =
cast(ubyte) c;"
On Friday, 6 May 2022 at 07:05:35 UTC, zjh wrote:
For example, I think `d` can also make use of `'winrt'`, which
is very important for `GUI` programming . `D` officials should
pay attention to `it`.
I have downloaded `dwinrt` and has many compilation errors!
Regularly introducing
Now all three parts of the round 1 are over and finalized.
There's a third-party website, which provides some stats:
https://cpjsmith.uk/gcj/year?year=2022
It's interesting that D is one of the least popular programing
languages with only a single digit number of users. It never
managed to
On Wednesday, 6 April 2022 at 19:28:53 UTC, Steven Schveighoffer
wrote:
With `arr.find!(someLambda)`, if the lambda is using data from
outside the lambda, it needs a closure, which means it may
(probably does) allocate your needed data into a GC heap block
that will then become garbage after
A plot twist. I actually used Golang for submitting all my
solutions in the qualification round:
https://codingcompetitions.withgoogle.com/codejam/submissions/00876ff1/0048a518
The reason is that right now I'm switching to Golang at work. And
Code Jam tasks are a good practice
Hello,
The Google Code Jam 2022 qualification round has started and it's
a good opportunity to practice programming language skills. I
wonder if there will be many nice and clean solutions submitted
in D language? We can discuss them after the contest.
On Friday, 11 February 2022 at 19:04:41 UTC, Sergey wrote:
Is this an attempt to implement a high performance solution
for the Benchmarks Game's LRU problem in D language?
Yes. There is no D version there. And I'm just curious how fast
is D in those problems.
Dlang (LDC), Crystal, Rust and
On Thursday, 10 February 2022 at 20:39:45 UTC, Sergey wrote:
Code could be found here:
https://github.com/cyrusmsk/lang_benchmark/tree/main/lru/source/d_comparison/mem
Is this an attempt to implement a high performance solution for
the Benchmarks Game's LRU problem in D language?
PS it
On Wednesday, 9 February 2022 at 21:05:47 UTC, Siarhei Siamashka
wrote:
Is the current implementation of associative arrays in D
language resistant to Denial of Service hash collision attacks?
Answering to myself. No, it isn't. Here's a simple example:
```D
import std, core.time;
const ulong
On Tuesday, 8 February 2022 at 21:42:06 UTC, H. S. Teoh wrote:
But as I said, this is overkill for something so trivial. Using
`bool[E]` or an RBTree works just fine.
Is the current implementation of associative arrays in D language
resistant to Denial of Service hash collision attacks?
*
On Saturday, 29 January 2022 at 00:52:10 UTC, H. S. Teoh wrote:
Trying out what I suggested on different OS's and toolchains
will give you a good idea of what's actually out there.
I will just reply with a quote from
On Monday, 31 January 2022 at 08:54:16 UTC, Patrick Schluter
wrote:
-O3 often chooses longer code and unrollsmore agressively
inducing higher miss rates in the instruction caches.
-O2 can beat -O3 in some cases when code size is important.
One of the historical reasons for favoring -O2
On Saturday, 29 January 2022 at 18:28:06 UTC, Ali Çehreli wrote:
(And now we know gdc can go about 7% faster with additional
command line switches.)
No, we don't know this yet ;-) That's just what I said and I may
be bullshitting. Or the configuration of my computer is
significantly
On Friday, 28 January 2022 at 23:43:00 UTC, H. S. Teoh wrote:
You don't have to rely on any opinions. Try it out yourself and
find out for sure.
I guess, my problem and the source of all confusion is that I'm
way too used to developing C++ code. And in the C++ ecosystem
your recommendation
On Thursday, 27 January 2022 at 21:50:12 UTC, kinke wrote:
An example:
[...]
Now if the calls are inlined, the behavior might not be
consistent anymore. So separate compilations with different
compiler flags can cause observable differences.
Thanks! This was very informative. Though I'm
On Friday, 28 January 2022 at 18:02:27 UTC, Iain Buclaw wrote:
For example, druntime depends on this behaviour.
Template:
https://github.com/dlang/druntime/blob/a0ad8c42c15942faeeafb016e81a360113ae1b6b/src/rt/config.d#L46-L58
Ouch. From where I stand, this looks like some really ugly hack
On Thursday, 27 January 2022 at 18:12:18 UTC, Johan Engelen wrote:
But the language requires ODR, so we can emit templates as
weak_odr, telling the optimizer and linker that the symbols
should be merged _and_ that ODR can be assumed to hold (i.e.
inlining is OK).
Thanks! This was also my
On Thursday, 9 December 2021 at 21:06:54 UTC, Siarhei Siamashka
wrote:
On Thursday, 9 December 2021 at 20:53:52 UTC, Siarhei Siamashka
wrote:
How would one construct a simple example of a template
symbol getting successfully overridden by a global symbol?
Forgot to mention that a template
On Wednesday, 26 January 2022 at 18:41:51 UTC, Iain Buclaw wrote:
The D language shot itself in the foot by requiring templates
to have weak semantics.
If DMD and LDC inline weak functions, that's their bug.
As I already mentioned in the bugzilla, it would be really useful
to see a
On Wednesday, 26 January 2022 at 18:00:41 UTC, Ali Çehreli wrote:
ldc shines with sprintf. And dmd suprises by being a little bit
faster than gdc! (?)
ldc (2.098.0): ~6.2 seconds
dmd (2.098.1): ~7.4 seconds
gdc (2.076.?): ~7.5 seconds
Again, here are the versions of the compilers that are
On Sunday, 23 January 2022 at 09:08:46 UTC, Stanislav Blinov
wrote:
Using `iota` here incurs additional computation and argument
copies that are actually never used, i.e. wasted work. So I'd
say go with `generate`, as that seems the intent.
Isn't this normally a compiler's job to eliminate
Hello,
I'm just trying to see if it's maybe possible to find some
teammates here for
https://codingcompetitions.withgoogle.com/hashcode ?
That said, I have never participated in HashCode before and I'm
not exactly committed yet. So I may abandon this idea if it
doesn't work out and/or
On Friday, 10 December 2021 at 13:35:37 UTC, Matheus wrote:
Hi,
Wouldn't the compiler be smart with this shadowing variable,
example:
void main(){
int j;
for(int i=0,j=0;i<10;++i){}
return;
}
onlineapp.d(3): Error: variable `j` is shadowing variable
`onlineapp.main.j`
So in
On Thursday, 9 December 2021 at 20:53:52 UTC, Siarhei Siamashka
wrote:
2. How would one construct a simple example of a template
symbol getting successfully overridden by a global symbol?
Here's my unsuccessful attempt:
```D
module template_f;
T f(T)(T a, T b) { return a + b; }
```
```D
1 - 100 of 105 matches
Mail list logo