Re: how to benchmark pure functions?

2022-10-28 Thread ab via Digitalmars-d-learn
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote: Hi, when trying to compare different implementations of the optimized builds of a pure function using benchmark from std.datetime.stopwatch, I get times equal to zero, I suppose because the functions are not executed as they do not have

how to benchmark pure functions?

2022-10-27 Thread ab via Digitalmars-d-learn
Hi, when trying to compare different implementations of the optimized builds of a pure function using benchmark from std.datetime.stopwatch, I get times equal to zero, I suppose because the functions are not executed as they do not have side effects. The same happens with the example from

Re: vibe.d / experience / feedback

2020-10-01 Thread ab via Digitalmars-d-learn
On Thursday, 1 October 2020 at 06:32:23 UTC, Robert M. Münch wrote: 3. Vibe can't handle GET & POST on the same URL... we solved this one as well: fortunately (and: of course) vibe can handle this. what lead us to believe otherwise, was that, unfortunately, one of the handlers crashed

Re: vibe.d / experience / feedback

2020-10-01 Thread ab via Digitalmars-d-learn
On Thursday, 1 October 2020 at 06:39:39 UTC, mipri wrote: On Thursday, 1 October 2020 at 06:32:23 UTC, Robert M. Münch wrote: 5. One can't access the raw HTTP request body, things must be go through Vibe's JSON parser. To get access to the raw body, a lot of workarounds are necessary. given

Re: My RPN calculator code review?

2020-07-18 Thread AB via Digitalmars-d-learn
On Saturday, 18 July 2020 at 10:33:23 UTC, Anonymouse wrote: I'm not happy about the looping and allocating replacements of spaced_args, Actually, I got rid of that code entirely in order to support negative values: -5 -6 * == 30

My RPN calculator code review?

2020-07-17 Thread AB via Digitalmars-d-learn
Hello, inspired by the "Tiny RPN calculator" example seen on the dlang homepage, I wanted to create my own version. I'd appreciate your opinions regarding style, mistakes/code smell/bad practice. Thank you. import std.array; import std.conv; import std.stdio; void

Progress printing with threads?

2020-07-01 Thread AB via Digitalmars-d-learn
Hello. I am unsure how to proceed about printing progress in my program. Suppose the program is processing a very big file and is iterating the file's bytes using a for loop. The processing takes several minutes and I want a progress percentage be printed every 2 seconds in this manner:

Re: Converting Lua source to D

2020-03-05 Thread AB via Digitalmars-d-learn
On Thursday, 5 March 2020 at 07:44:21 UTC, Jesse Phillips wrote: I am making an attempt convert Lua to D. This is less about the conversion and more about exploring the tooling to make it happen. I have chosen to do this file by file and attempting to start with linint. I wanted to make use

Re: How to sum multidimensional arrays?

2020-03-01 Thread AB via Digitalmars-d-learn
On Saturday, 29 February 2020 at 19:04:12 UTC, p.shkadzko wrote: On Friday, 28 February 2020 at 16:51:10 UTC, AB wrote: On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote: [...] Your Example with a minimal 2D array. module test2; import std.random : Xorshift,

Re: How to sum multidimensional arrays?

2020-02-28 Thread AB via Digitalmars-d-learn
On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote: I'd like to sum 2D arrays. Let's create 2 random 2D arrays and sum them. ``` import std.random : Xorshift, unpredictableSeed, uniform; import std.range : generate, take, chunks; import std.array : array; static T[][]