Re: opCmp / opEquals do not actually support partial orders

2018-07-18 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 18 July 2018 at 15:13:24 UTC, rikki cattermole wrote: On 19/07/2018 3:03 AM, Ivan Kazmenko wrote: That's by DMD32 on Windows.  (Sorry, my DMD64 broke after upgrading Visual Studio to 2017, and I failed to fix it right now.  Anyway, it's not like x86_64 uses a differ

Re: opCmp / opEquals do not actually support partial orders

2018-07-18 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 18 July 2018 at 14:02:28 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 18 July 2018 at 13:12:05 UTC, Ivan Kazmenko wrote: Leaving x uninitialized, or using floats, work about the same. No, floats are a whole lot less slow. Are they? Locally, I don't see much diffe

Re: opCmp / opEquals do not actually support partial orders

2018-07-18 Thread Ivan Kazmenko via Digitalmars-d
on ones (or they are just lazy). As a result, the developers don't overuse them. Ivan Kazmenko.

Re: dmd optimizer now converted to D!

2018-07-05 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 5 July 2018 at 14:30:05 UTC, Dukc wrote: foreach(j, ref piece; cast(int[4][]) a) { auto pieceI = j * 4; static foreach(i; 0 .. piece.length) piece[i] = pieceI + i; } Can probably be made even better by designing some template helper. Thanks! The cast to an array of int[4]s

Re: dmd optimizer now converted to D!

2018-07-05 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 5 July 2018 at 14:05:42 UTC, Seb wrote: FYI: you can introduce scopes with static foreach to declare new variables: for (int i = 0; i < 4 * n; i += 4) { static foreach (k; 0..4) {{ auto idx = i + k a[idx] += idx; }} } Thanks! The two parentheses trick i

Re: dmd optimizer now converted to D!

2018-07-05 Thread Ivan Kazmenko via Digitalmars-d
example. Is there any better way? To prevent introducing bugs when micro-optimizing, I'd like the loop body to remain as unchanged as it can be. Ivan Kazmenko.

Re: Building is slow!

2018-04-16 Thread Ivan Trombley via Digitalmars-d
I want to revisit this issue. Building 64 bit on Linux, release or debug, is fast. However, building 64 bit release on Windows 10 is super slow. I have a cross platform app that uses gtk-d. Today, I updated DMD to 2.079.1 and the gtk-d lib to 3.8.0. When I performed a debug build on Windows 1

Re: Vulkan

2018-02-16 Thread Ivan Trombley via Digitalmars-d
On Wednesday, 14 February 2018 at 00:22:25 UTC, flamencofantasy wrote: Maybe these work, not sure; https://github.com/Rikarin/VulkanizeD Thanks, I'll check this out.

Re: Vulkan

2018-02-16 Thread Ivan Trombley via Digitalmars-d
On Wednesday, 14 February 2018 at 02:40:18 UTC, Mike Parker wrote: What [does] it mean to say they don't work? Have you reported any issues? I don't see any in the DerelictVulkan repo. If something's broken, please report it so it can be fixed. Derelict-vulkan is Windows only ATM.

Vulkan

2018-02-13 Thread Ivan Trombley via Digitalmars-d
I wanted to do some experimentation with Vulkan using D. None of the projects that I found (derelict-vulkan, d-vulkan and erupted) work. Are there D bindings to Vulkan that actually work?

Re: [RFC] IDE starter kit

2018-02-02 Thread Ivan Trombley via Digitalmars-d
Here's how I get started: - Install DMD. - Install Visual Studio Code. - Add Jan Jurzitza's (webfreak) serve-d and Native Debug plugins to VSC. - Get busy.

Re: Dscanner: intentionally unused variable

2018-01-07 Thread Ivan Trombley via Digitalmars-d
On Sunday, 7 January 2018 at 17:02:02 UTC, visitor wrote: It seems a simple underscore "_" as a variable name tells Dscanner exactly that. Any number of underscores but underscores only apparently. That works too. Thanks.

Re: Dscanner: intentionally unused variable

2018-01-07 Thread Ivan Trombley via Digitalmars-d
On Sunday, 7 January 2018 at 03:41:18 UTC, SimonN wrote: Another way would be to have the RAII wrapper in a with statement, but it produces extra indentation, which you might not like: with (MyStruct(100, 200)) { // code that uses the new clip rectangle } -- Simon This works

Re: Dscanner: intentionally unused variable

2018-01-07 Thread Ivan Trombley via Digitalmars-d
On Sunday, 7 January 2018 at 08:46:40 UTC, Basile B. wrote: More simple is to understand D-Scanner limitations and accept that warnings are only warnings and that a message doesn't necessarily mean that there's something to do. If the output is clogged with warnings then it's more difficult t

Dscanner: intentionally unused variable

2018-01-06 Thread Ivan Trombley via Digitalmars-d
While working with SDL, I found that I kept using the same pattern over and over: - Get the current clip rectangle. - Set a new clip rectangle. - restore the old clip rectangle on scope (exit). Instead of writing that code again and again, I wrote a simple function that returns a struct which r

Re: An unfortunate quirk of DMD32 converting floating-point to string

2017-12-28 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 26 December 2017 at 23:58:43 UTC, Walter Bright wrote: On 12/26/2017 3:41 PM, Ivan Kazmenko wrote: While exploring quirks of floating-point values, as well as C/C++/D convenience with them, I stumbled on, in essence, the following (DMD32 on Windows): The issue is really with the

SDL_Quit after GC shutdown?

2017-12-27 Thread Ivan Trombley via Digitalmars-d
I believe that I should call SDL_Quit before my program terminates. However, some objects may be holding on to SDL resources and freeing these resources (particularly truetype resources) causes crashiness if SDL_Quit is called before. Is there a way to have SDL_Quit (and TTF_Quit) called after

An unfortunate quirk of DMD32 converting floating-point to string

2017-12-26 Thread Ivan Kazmenko via Digitalmars-d
oup, since it's quirky, and I may have easily missed something important. Ivan Kazmenko.

Re: SDL2 texture blend help

2017-12-13 Thread Ivan Trombley via Digitalmars-d
On Wednesday, 13 December 2017 at 13:54:28 UTC, Martin Drašar wrote: Dne 13.12.2017 v 4:03 Ivan Trombley via Digitalmars-d napsal(a): On Wednesday, 13 December 2017 at 01:44:33 UTC, Dmitry wrote: On Tuesday, 12 December 2017 at 23:28:23 UTC, Ivan Trombley wrote: Here's the code that pro

Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d
Here's a page that describes the issue: http://ssp.impulsetrain.com/gamma-premult.html

Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d
On Wednesday, 13 December 2017 at 01:44:33 UTC, Dmitry wrote: On Tuesday, 12 December 2017 at 23:28:23 UTC, Ivan Trombley wrote: Here's the code that produces the correct results (exactly the same as GIMP): Share images you used, please. Background image: http://a4.pbase.com/o10/09/605

Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d
GIMP 2.9, that is.

Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d
On Tuesday, 12 December 2017 at 07:12:07 UTC, Dmitry wrote: On Tuesday, 12 December 2017 at 06:27:30 UTC, Ivan Trombley wrote: This isn't a scaling problem (which is totally solved by Scaling is not a prerequisite for this problem. pre-multiplying the alpha with the colors BTW). This

Re: SDL2 texture blend help

2017-12-11 Thread Ivan Trombley via Digitalmars-d
On Tuesday, 12 December 2017 at 03:34:51 UTC, Dmitry wrote: On Tuesday, 12 December 2017 at 03:32:05 UTC, Ivan Trombley wrote: It turns out that it's an issue with the color channels being in sRGB color space and the alpha channel being linear. I verified this by doing a software blend o

Re: SDL2 texture blend help

2017-12-11 Thread Ivan Trombley via Digitalmars-d
It turns out that it's an issue with the color channels being in sRGB color space and the alpha channel being linear. I verified this by doing a software blend of the images and then doing another software blend using gamma corrected values. There's a setting in opengl to correct for it, glEn

Re: SDL2 texture blend help

2017-12-11 Thread Ivan Trombley via Digitalmars-d
On Monday, 11 December 2017 at 07:04:19 UTC, Mike Parker wrote: On Monday, 11 December 2017 at 04:57:44 UTC, Ivan Trombley wrote: Any SDL experts out there that can give me a clue? I've used SDL quite a bit, but can't help with your specific problem. However, I suggest you try t

SDL2 texture blend help

2017-12-10 Thread Ivan Trombley via Digitalmars-d
Experimenting with compositing images in SDL2, I get a dark edge around my textures. In the image below, you can see the top example where I composite the cyan image on top of the blue/magenta image looks correct but the bottom example, which is done using SDL_RenderCopy is not correct. http:

Re: Building is slow!

2017-12-05 Thread Ivan Trombley via Digitalmars-d
There are issues with using "--build-mode=singleFile --parallel". On Windows I get errors saying that it can't write out some intermediate files (it looks like the file names may be too long for Windows) and on Linux, it makes the executable at least 3 MB larger in release mode. Also, it doesn'

Re: Building is slow!

2017-12-02 Thread Ivan Trombley via Digitalmars-d
On Saturday, 2 December 2017 at 23:26:20 UTC, Ivan Trombley wrote: On Saturday, 2 December 2017 at 14:34:58 UTC, Arek wrote: You can try `dub build --build-mode=single-file --parallel`. It will execute separate instance of compiler for each source file. If --parallel is given, dub will launch

Re: Building is slow!

2017-12-02 Thread Ivan Trombley via Digitalmars-d
On Saturday, 2 December 2017 at 14:34:58 UTC, Arek wrote: You can try `dub build --build-mode=single-file --parallel`. It will execute separate instance of compiler for each source file. If --parallel is given, dub will launch several instances of dmd in parallel. I get the error: Error pro

Re: Building is slow!

2017-12-02 Thread Ivan Trombley via Digitalmars-d
On Saturday, 2 December 2017 at 03:08:10 UTC, rjframe wrote: There is a --parallel flag: `dub build --parallel`. The help string says it "Runs multiple compiler instances in parallel, if possible." Thanks, I'll give that a try. After an hour, I pressed CTRL+C, shut it down and went home.

Building is slow!

2017-12-01 Thread Ivan Trombley via Digitalmars-d
When DUB bulds the gtk-d library, it takes a long time. This is mostly because it's only using one processor. It hasn't been such a big deal on Linux but I'm building my app on Windows right now and it been building gtk-d for the last half hour! Is there any way to make DUB use more processors?

Re: Localization (i18n) Options

2017-11-30 Thread Ivan Trombley via Digitalmars-d
Figured it out. I was initializing some member strings where they were declared in a class. I just needed to move that initialization to the constructor.

Re: Localization (i18n) Options

2017-11-30 Thread Ivan Trombley via Digitalmars-d
On Thursday, 30 November 2017 at 00:50:35 UTC, Gerald wrote: On Tuesday, 28 November 2017 at 07:39:19 UTC, Ivan Trombley wrote: On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote: On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote: Please, write a HowTo some where. GtkD lack of

Re: Localization (i18n) Options

2017-11-27 Thread Ivan Trombley via Digitalmars-d
On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote: On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote: Please, write a HowTo some where. GtkD lack of documentation it's very anoying. I've gotten this going with Terminix and posted some information what it took to get it going here:

Re: Why does phobos have collisions?

2017-06-07 Thread Ivan Kazmenko via Digitalmars-d
t. As std.algorithm's strip is more generic, it cannot assume what's the "whitespace" to be stripped, so it's not callable without explicitly specifying what to strip. I've experienced this too, and it's really a bit confusing the first time it happens. Ivan Kazmenko.

Re: DUB: Multiprocess?

2017-05-14 Thread Ivan Trombley via Digitalmars-d
On Sunday, 14 May 2017 at 21:01:37 UTC, Basile B. wrote: On Sunday, 14 May 2017 at 20:23:17 UTC, Ivan Trombley wrote: When I build C++ projects using make, I can specify how many processes I want to use (-j). This keeps the processors full and happy and greatly reduces the overall build time

DUB: Multiprocess?

2017-05-14 Thread Ivan Trombley via Digitalmars-d
When I build C++ projects using make, I can specify how many processes I want to use (-j). This keeps the processors full and happy and greatly reduces the overall build time. Does DUB have a similar way of compiling each file in it's own process or thread?

Re: [OT] Algorithm question

2017-05-02 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 2 May 2017 at 10:35:46 UTC, Ivan Kazmenko wrote: I hope some part of the idea is still salvageable. For example, what if we put the intervals in a queue instead of a stack? I tried to implement a similar approach, but instead of a queue or a stack, I used a random-access array of

Re: [OT] Algorithm question

2017-05-02 Thread Ivan Kazmenko via Digitalmars-d
ageable. For example, what if we put the intervals in a queue instead of a stack? Ivan Kazmenko.

Re: [OT] Algorithm question

2017-05-01 Thread Ivan Kazmenko via Digitalmars-d
memory used will be O(n/m) too. I can put together an example implementation if this best satisfies your requirements. Ivan Kazmenko.

Re: Zcoin implementation bug enabled attacker to create 548, 000 Zcoins

2017-03-09 Thread Ivan Kazmenko via Digitalmars-d
scape purity), but perhaps may be applied beyond simple debugging and profiling. Ivan Kazmenko.

Re: To use a scripting language or not to use a scripting language?

2017-01-06 Thread Ivan Kazmenko via Digitalmars-d
ke it possible to use for game logic scripts, too. But considering the points above, it still won't necessarily be a good idea. Some of the top games use Python (Civilization IV) and Lua (World of Warcraft, Far Cry, SimCity 4) for scripting. Ivan Kazmenko.

Re: Function Proposal: std.algorithm.iteration : cumulativeSum

2016-11-01 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 1 November 2016 at 22:13:29 UTC, e-y-e wrote: On Tuesday, 1 November 2016 at 22:09:50 UTC, e-y-e wrote: On Tuesday, 1 November 2016 at 22:06:36 UTC, Ivan Kazmenko wrote: ... damn, that was a typo [cumulativeFold -> cumulativeSum] similarly, in the first para, cumulativeSum!

Re: Function Proposal: std.algorithm.iteration : cumulativeSum

2016-11-01 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 1 November 2016 at 21:52:40 UTC, e-y-e wrote: I'd like to propose the function cumulativeFold as a new addition to std.algorithm.iteration. I have already opened a pull request [1] for this addition so the full implementation is available there. The function signatures are: DMD 2.

Re: 16MB static arrays again...

2016-08-24 Thread Ivan Kazmenko via Digitalmars-d
don't realize, why do static arrays have this size limit on them? Heh, I'm the OP of the 2006 thread. Ten years passed, and I've learned to use dynamic arrays in D with negligible loss of performance most of the time. But of course I'd still like to have no such arti

Re: D for competitive programming

2016-07-30 Thread Ivan Kazmenko via Digitalmars-d
ready support quite a few languages but not D (among what I've seen, HackerEarth and CodeFights sites come to mind), one could have more success in persuading them to include a D compiler as well. When many languages are already onboard, adding another one is more likely to be strai

Re: add attributes to debug

2016-07-24 Thread Ivan Kazmenko via Digitalmars-d
like: version (debug_mem) {do something memory wise} version (debug_see) {write a message to console} In my opinion, saving a few characters here does not get anywhere near a good reason to add language complexity. Ivan Kazmenko.

Re: Researcher question – what's the point of semicolons and curly braces?

2016-05-03 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 3 May 2016 at 04:24:37 UTC, Adam D. Ruppe wrote: But I'm really curious what the gendered aspect turns out as. I suspect the effect, if it indeed exists, would be strongly tied to the oft-repeated lie that "girls aren't good at math" - math famously uses a lot of symbols, so that as

Re: Compiling with -profile=gc makes program crash - why?

2016-04-21 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 21 April 2016 at 10:57:12 UTC, Ivan Kazmenko wrote: Humm, when I searched whether it should work, I only found a reassuring post by Walter[1] almost a year ago. The issue tracker does not seem to contain an entry either. Perhaps I should create one, then. [1] http

Re: Compiling with -profile=gc makes program crash - why?

2016-04-21 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 21 April 2016 at 09:23:26 UTC, tcak wrote: I'm trying to use DMD option "-profile=gc". You are using "spawn". So it is a multithreaded program. -profile=gc doesn't work with multithreadd programs. Always creates problems. Humm, when I searched whether it should work, I only fo

Re: Compiling with -profile=gc makes program crash - why?

2016-04-20 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 20 April 2016 at 22:27:36 UTC, Ivan Kazmenko wrote: I'm trying to use DMD option "-profile=gc". With this option, the following simple program crashes with 2.071.0 down to 2.069.0 but still works on 2.068.2. The command line is "dmd -g -profile=gc p

Compiling with -profile=gc makes program crash - why?

2016-04-20 Thread Ivan Kazmenko via Digitalmars-d
guarantees that the spawned thread finishes before the main thread, but the third example, also crashing, seems to contradict that: -prfail3.d- import std.concurrency; void someWork () {auto x = [1];} void main () { spawnLinked (&someWork); try {receive ((int) {});} catch (LinkTerminated o) {} } - Ivan Kazmenko.

Mention GSoC on the front page?

2016-04-14 Thread Ivan Kazmenko via Digitalmars-d
front page of dlang.org as well? It could fit under Contribute, or maybe a separate section closer to the top. Ivan Kazmenko.

Re: Idempotent partition around median of 5?

2016-02-05 Thread Ivan Kazmenko via Digitalmars-d
On Saturday, 6 February 2016 at 07:06:27 UTC, Ivan Kazmenko wrote: On Saturday, 6 February 2016 at 00:59:17 UTC, Andrei Alexandrescu wrote: On 02/05/2016 06:36 AM, Ivan Kazmenko wrote: Another interesting task would be to make the function stable, but I don't see how it is possible with

Re: Idempotent partition around median of 5?

2016-02-05 Thread Ivan Kazmenko via Digitalmars-d
On Saturday, 6 February 2016 at 00:59:17 UTC, Andrei Alexandrescu wrote: On 02/05/2016 06:36 AM, Ivan Kazmenko wrote: Another interesting task would be to make the function stable, but I don't see how it is possible with such flat structure. Under what circumstances isn't you

Re: Idempotent partition around median of 5?

2016-02-05 Thread Ivan Kazmenko via Digitalmars-d
< b[4]); enforce (equal (b, c)); } while (nextPermutation (a)); } - Another interesting task would be to make the function stable, but I don't see how it is possible with such flat structure. Ivan Kazmenko.

Re: The Quick Mom Algorithm

2016-02-02 Thread Ivan Kazmenko via Digitalmars-d
On Friday, 29 January 2016 at 22:47:44 UTC, Andrei Alexandrescu wrote: http://dpaste.dzfl.pl/05a82699acc8 While thinking of MoM and the core reasons of its being slow (adds nice structure to its input and then "forgets" most of it when recursing), I stumbled upon a different algorithm. It's m

Re: So... add maxCount and maxPos?

2016-01-21 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 21 January 2016 at 12:17:26 UTC, default0 wrote: On Thursday, 21 January 2016 at 02:36:05 UTC, Ivan Kazmenko wrote: An alternative would be to define min(one argument) to just be that argument. That would be consistent with what we have now, but violates the principle of least

Re: So... add maxCount and maxPos?

2016-01-20 Thread Ivan Kazmenko via Digitalmars-d
On Thursday, 21 January 2016 at 01:11:19 UTC, Andrei Alexandrescu wrote: On 01/20/2016 04:22 PM, Ivan Kazmenko wrote: 1. The minimum or maximum element itself. I write it as a.minPos.front. That's almost fine, but maybe there is a more expressive way? Sadly, no. I'm very willing

Re: So... add maxCount and maxPos?

2016-01-20 Thread Ivan Kazmenko via Digitalmars-d
e make things a bit more clear. Don't know how much of a justification that is. Ivan Kazmenko.

Re: topN using a heap

2016-01-19 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 19 January 2016 at 13:52:08 UTC, Andrei Alexandrescu wrote: On 01/18/2016 09:21 PM, Ivan Kazmenko wrote: Do you think sort and topN would be attackable if they used a per-process-seeded RNG as per Xinok's idea? -- Andrei Yes, but with a little interactivity (not generatin

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
. At the very least, googling for "median of medians in practice" and such yields the tag wiki from StackOverflow.com: "The constant factor in the O(n) is large, and the algorithm is not commonly used in practice.". Ivan Kazmenko.

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
ardless of whether n is close to the edge. Ivan Kazmenko.

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
theoretical standpoint (not taking current D purity rules into account), I'd say using a pointer (which may be modified by GC) is as pure as just allowing a static RNG (a global one, or even another instance dedicated specifically to sort/topN). Ivan Kazmenko.

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 18 January 2016 at 23:18:03 UTC, Ilya wrote: A RNGs don't improve worst case. It only changes an permutation for worst case. --Ilya Still, use of RNG makes it impossible to construct the worst case beforehand, once and for all. In that sense, this is a regression.

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 18 January 2016 at 12:00:10 UTC, Ivan Kazmenko wrote: Here goes the test which shows quadratic behavior for the new version: http://dpaste.dzfl.pl/e4b3bc26c3cf (dpaste kills the slow code before it completes the task) Correction: this is the result of removing a uniform call in

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 18 January 2016 at 12:00:10 UTC, Ivan Kazmenko wrote: On Sunday, 17 January 2016 at 22:20:30 UTC, Andrei Alexandrescu wrote: All - let me know how things can be further improved. Thx! Here goes the test which shows quadratic behavior for the new version: http://dpaste.dzfl.pl

Re: topN using a heap

2016-01-18 Thread Ivan Kazmenko via Digitalmars-d
On Sunday, 17 January 2016 at 22:20:30 UTC, Andrei Alexandrescu wrote: On 01/17/2016 03:32 PM, Ivan Kazmenko wrote: Here is a more verbose version. OK, very nice. Thanks! I've modified topN to work as follows. In a loop: * If nth <= r.length / log2(r.length)^^2 (or is similarly c

Re: topN using a heap

2016-01-17 Thread Ivan Kazmenko via Digitalmars-d
On Sunday, 17 January 2016 at 16:06:31 UTC, Andrei Alexandrescu wrote: On 01/17/2016 06:41 AM, Ivan Kazmenko wrote: The average case is O(n + (k log n log k)) for small enough k. So, any k below roughly n / log^2 (n) makes the second summand less than the first. I don't understand ho

Re: topN using a heap

2016-01-17 Thread Ivan Kazmenko via Digitalmars-d
faster for k close to boundary and special inputs). So, provide the default but let the user choose. Ivan Kazmenko.

Re: topN using a heap

2016-01-17 Thread Ivan Kazmenko via Digitalmars-d
On Sunday, 17 January 2016 at 03:26:54 UTC, Andrei Alexandrescu wrote: On 1/16/16 9:37 PM, Timon Gehr wrote: Ivan's analysis suggests that even something significantly larger, like n/log(n)² might work as an upper bound for k. I'm not clear on how you got to that boundary. There are a few im

Re: topN using a heap

2016-01-16 Thread Ivan Kazmenko via Digitalmars-d
On Saturday, 16 January 2016 at 15:25:50 UTC, Andrei Alexandrescu wrote: 3. At the end, swap the largest in the heap with the 10th and you're done! And why this? Do we additionally require the k-th element to arrive exactly on k-th place?

Re: topN using a heap

2016-01-16 Thread Ivan Kazmenko via Digitalmars-d
On Saturday, 16 January 2016 at 15:25:50 UTC, Andrei Alexandrescu wrote: That's quite a bit of work, so 3934 uses an alternate strategy for finding the smallest 10: 1. Organize the first 11 elements into a max heap 2. Scan all other elements progressively. Whenever an element is found that is

Re: Today was a good day

2016-01-15 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 13 January 2016 at 03:38:45 UTC, Andrei Alexandrescu wrote: I tried a static rng but found out that pure functions call sort(). Overall I'm not that worried about attacks on sort(). So, sort() is still Introsort (O(n log n) worst case), but topN() can show quadratic performance?

Re: dmd codegen improvements

2015-08-21 Thread Ivan Kazmenko via Digitalmars-d
On Friday, 21 August 2015 at 01:29:12 UTC, H. S. Teoh wrote: On Fri, Aug 21, 2015 at 01:20:25AM +, jmh530 via Digitalmars-d wrote: On Friday, 21 August 2015 at 00:00:09 UTC, H. S. Teoh wrote: The gdc version, by contrast, inlines *everything*, This could be why I've observed performance

Re: dmd codegen improvements

2015-08-18 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 18 August 2015 at 23:30:26 UTC, Walter Bright wrote: On 8/18/2015 4:05 PM, H. S. Teoh via Digitalmars-d wrote: Maybe when I get some free time this week, I could look at the disassembly of one of my programs again to give some specific examples. Please do. Sorry to repeat myself

Re: dmd codegen improvements

2015-08-18 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 18 August 2015 at 10:45:49 UTC, Walter Bright wrote: ... 3. data flow analysis optimizations like constant propagation, dead code elimination, register allocation, loop invariants, etc. Modern compilers (including dmd) do all three. So if you're comparing code generated by dmd/gd

Re: std.experimental.collection.functional.slist

2015-06-19 Thread Ivan Timokhin via Digitalmars-d
Correct me if I'm wrong, but it seems that the GC is unaware of any memory coming from an allocator (unless it's a GCAllocator, of course), so it won't scan it. If that's the case, that's bound to cause problems if T has indirections. On Thu, Jun 18, 2015 at 11:32:05PM +, Andrei Alexandrescu w

Re: std.experimental.collection.functional.slist

2015-06-19 Thread Ivan Timokhin via Digitalmars-d
On Fri, Jun 19, 2015 at 06:36:26AM -0700, Andrei Alexandrescu wrote: > On 6/19/15 4:51 AM, Ivan Timokhin wrote: > > 2. Only dynamic allocator customisation is supported (unlike C++ > > containers). Is > > this deliberate? > > Yes; I think C++'s approach to all

Re: std.experimental.collection.functional.slist

2015-06-19 Thread Ivan Timokhin via Digitalmars-d
On Fri, Jun 19, 2015 at 01:49:14PM +, Jonathan M Davis wrote: > On Friday, 19 June 2015 at 13:36:22 UTC, Andrei Alexandrescu > wrote: > >> 3. Shouldn't `front` functions be const? > > > > Good point. Made const. > > That's not necessarily a good idea. What if the element type > can't even be

Re: std.experimental.collection.functional.slist

2015-06-19 Thread Ivan Timokhin via Digitalmars-d
A couple of thoughts: 1. It seems that an allocator is a public field of SList. Should it be so? What happens if someone changes an allocator while the list holds nodes allocated with the old one? 2. Only dynamic allocator customisation is supported (unlike C++ containers). Is this deliberate? 3

Re: Lets talk about fibers

2015-06-04 Thread Ivan Timokhin via Digitalmars-d
On Thu, Jun 04, 2015 at 07:24:47AM +, Liran Zvibel wrote: > If you can come up with another programming model that leverages > fibers (and is popular), and moving fibers between threads makes > sense in that model, then I think the discussion should be how > stronger that other model is with fi

Re: Quit running foreign unittests >_

2015-04-28 Thread Ivan Kazmenko via Digitalmars-d
f containers (say, N operations with a container), and if integrity checks are enabled at this time, it totals to N^2 trivial operations which may not be feasible. Ivan Kazmenko.

Re: Quit running foreign unittests >_

2015-04-27 Thread Ivan Kazmenko via Digitalmars-d
don't see whether it fits the larger picture, but still think it's worth to consider. Ivan Kazmenko.

Re: Quit running foreign unittests >_

2015-04-27 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 27 April 2015 at 15:29:05 UTC, Steven Schveighoffer wrote: On 4/27/15 10:30 AM, Ivan Kazmenko wrote: On Monday, 27 April 2015 at 11:30:04 UTC, Steven Schveighoffer wrote: The problem is as follows: 1. Unit tests for some library are written for that library. They are written to

Re: Quit running foreign unittests >_

2015-04-27 Thread Ivan Kazmenko via Digitalmars-d
bug = RBDoChecks;" line. This looks inconsistent. For RedBlackTree, compile the following with or without -unittest option and run for a visible difference in speed (runs momentarily or for a few seconds): - import std.container; void main() { auto t = redBlackTree!int; foreach (i; 0..3000) t.insert(i); } - Ivan Kazmenko.

Re: readln() doesn't stop to read the input.

2015-03-27 Thread Ivan Kazmenko via Digitalmars-d
worth noting, the best place for such questions in D.learn group: http://forum.dlang.org/group/digitalmars.D.learn Ivan Kazmenko.

Re: RCArray is unsafe

2015-03-04 Thread Ivan Timokhin via Digitalmars-d
Excuse me if I miss something obvious, but: void main() { auto arr = RCArray!int([0]); foo(arr, arr[0]); } void foo(ref RCArray!int arr, ref int val) { { auto copy = arr; //arr's (and copy's) reference counts are both 2 arr = RCA

Re: An exegesis of Walter's reference counted slice

2015-02-25 Thread Ivan Timokhin via Digitalmars-d
On Wed, Feb 25, 2015 at 08:06:48AM -0800, Andrei Alexandrescu wrote: > On 2/25/15 1:58 AM, Ivan Timokhin wrote: > > Oh. So, whenever you pass a reference-counted slice around, you need to do > > it with the full inc/dec protocol, which, as Walter has mentioned several > > ti

Re: An exegesis of Walter's reference counted slice

2015-02-25 Thread Ivan Timokhin via Digitalmars-d
Andrei Alexandrescu wrote: > On 2/24/15 1:33 PM, Ivan Timokhin wrote: >> Is there any plan to allow safe conversions to T[] (in restricted >> circumstances, of course)? > > We'd want to avoid it because that would necessitate the whole "scope" > parapher

Re: An exegesis of Walter's reference counted slice

2015-02-24 Thread Ivan Timokhin via Digitalmars-d
Andrei Alexandrescu wrote: > I modified Walter's sample code to this: > http://dpaste.dzfl.pl/f3d854feede9. It uses malloc for both the array > and the reference count, and also uses @trusted minimally. I inserted > assert()s here and there to clarify the workings. Nothing big except for > the car

Re: [DRAFT] This Week in D - Jan 18

2015-01-19 Thread Ivan Timokhin via Digitalmars-d
19.01.2015 04:42, Adam D. Ruppe пишет: Anyone like to do a quick proofread of the next edition of This Week in D? http://arsdnet.net/this-week-in-d/jan-18.html Do NOT post this publically yet - it is just a draft, I want to do the broad public release/announcement either later tonight or first

Re: problem with size_t and an easy solution

2014-12-10 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 10 December 2014 at 10:59:17 UTC, ketmar via Digitalmars-d wrote: > that is absolutely nonsense, you *CAN'T* "recover" from > invalid code. > that is the fact. fact: Earth is not a sphere. fact: you > can't > automatically recover from invalid code. That sounds much like an opini

Re: problem with size_t and an easy solution

2014-12-10 Thread Ivan Kazmenko via Digitalmars-d
On Wednesday, 10 December 2014 at 02:15:04 UTC, ketmar via Digitalmars-d wrote: On Tue, 09 Dec 2014 17:28:15 + Ivan Kazmenko via Digitalmars-d wrote: A well-designed language allows to recover from errors with good probability if compiler can recover from error, it should not report the

Re: problem with size_t and an easy solution

2014-12-09 Thread Ivan Kazmenko via Digitalmars-d
On Tuesday, 9 December 2014 at 03:14:23 UTC, ketmar via Digitalmars-d wrote: somehow Walter can't accept that after emiting the first error compiler is in undefined state, and trying to pretend that it is in well-defined state or guess what well-defined state must be is a nonsense. A well-des

Re: problem with size_t and an easy solution

2014-12-08 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 8 December 2014 at 14:31:50 UTC, ketmar via Digitalmars-d wrote: On Mon, 08 Dec 2014 13:49:30 + Ivan Kazmenko via Digitalmars-d wrote: Personally, when I face the need for a size_t, I usually can (and do) use auto instead. And even if I have to spell it, I don't care too

Re: problem with size_t and an easy solution

2014-12-08 Thread Ivan Kazmenko via Digitalmars-d
On Monday, 8 December 2014 at 08:46:49 UTC, bearophile wrote: Freddy: Why not keep size_t implictly convertable but disallow it for usize. This is an interesting idea. (But the name "uword" seems better). The char, wchar (word char) and dchar (double word char) types seem to disagree. Th

Re: RFC: scope and borrowing

2014-10-04 Thread Ivan Timokhin via Digitalmars-d
04.10.2014 21:01, Ivan Timokhin пишет: 04.10.2014 17:38, "Marc =?UTF-8?B?U2Now7x0eiI=?= " пишет: I think the key is in separating the scope attribute and the owner. The former needs to be part of the type, the latter doesn't. In this vein, it's probably a good idea to restr

Re: RFC: scope and borrowing

2014-10-04 Thread Ivan Timokhin via Digitalmars-d
04.10.2014 17:38, "Marc =?UTF-8?B?U2Now7x0eiI=?= " пишет: On Friday, 3 October 2014 at 19:08:10 UTC, Ivan Timokhin wrote: 29.09.2014 18:17, "Marc =?UTF-8?B?U2Now7x0eiI=?= " пишет: ... Now, an idea that I have is that bare scope should be just a syntactic sugar for self-owned

  1   2   >