as good as it does "C" or "C++". Any suggestions?
-
Ivan Kazmenko.
erface for every language
I decide to write in.
And sometimes CodeBlocks for larger projects.
Ivan Kazmenko.
sentations at the hash indices will suffice. On the other
hand, if you plan to visit 10^12 nodes, and the graph is not very
sparse or very dense (and not regular in any obvious way besides
what is described), perhaps you won't get the required
compression level (1/1000) anyway.
Ivan Kazmenko.
rth a bugreport. What do you guys think?
Ivan Kazmenko.
uaranteed-n-log-n algorithm instead of (3) when it goes too
deep. This comes at a (small) cost of checking the current depth
on every call to quicksort.
The above is just my retelling of a great short article "A Killer
Adversary for Quicksort" by M. D. McIlroy here:
http://www.cs.dartmouth.edu/~doug/mdmspe.pdf
Ivan Kazmenko.
On Sunday, 17 November 2013 at 01:07:20 UTC, Ivan Kazmenko wrote:
Now, the assumption of picking a pivot in O(1) comparisons
covers a broad variety of pivot choices, including
first/last/middle/random element, median of three or five,
median of medians, or any combination of these. The random
On Sunday, 17 November 2013 at 03:58:58 UTC, Andrei Alexandrescu
wrote:
On 11/16/13 5:07 PM, Ivan Kazmenko wrote:
The above is just my retelling of a great short article "A
Killer
Adversary for Quicksort" by M. D. McIlroy here:
http://www.cs.dartmouth.edu/~doug/mdmspe.pdf
Nice stor
On Sunday, 17 November 2013 at 01:48:14 UTC, Craig Dillabaugh
wrote:
On Sunday, 17 November 2013 at 01:07:20 UTC, Ivan Kazmenko
wrote:
Regarding an ideal pivot choice for quicksort, I'd like to
emphasize that it is simply non-existent. Here's why.
Let us measure quicksort performa
On Sunday, 17 November 2013 at 13:07:40 UTC, Timon Gehr wrote:
On 11/17/2013 02:07 AM, Ivan Kazmenko wrote:
The random pick fails in the following sense: if we seed the
RNG,
construct a killer case, and then start with the same seed, we
get
Theta(n^2) behavior reproduced.
Hence, in no sense
dopted to some parts of D development, provided
that some of the current developers will like the idea and be
really willing to try it.
-
Ivan Kazmenko.
de these design and
development contests, and the number of participants in algorithm
branch is much larger: the entry barrier is lower, the short time
frame is comfortable, and it is generally more fun.
Still, this type of contests (component) would require a
considerable effort to start.
-
Ivan Kazmenko.
On Sunday, 9 June 2013 at 11:56:42 UTC, Andrej Mitrovic wrote:
There are some bugs with it currently, but I think they're
fixable.
Currently, "with" does not look into "alias this" members which
somewhat limits its usefulness:
http://d.puremagic.com/issues/show_bug.cgi?id=6711
http://d.purem
nd 6. Reference implementation didn't work for me, but it may
be actually my fault...)
Given the points above, I won't make any decisions based on data
from that page :) .
Ivan Kazmenko.
f silently picking one of them.
Ivan Kazmenko.
than swaps. It would be a regression to
disallow sorting of entities with disabled assignment.
Ivan Kazmenko.
On Sunday, 29 December 2013 at 17:12:14 UTC, John Colvin wrote:
On Sunday, 29 December 2013 at 12:57:43 UTC, Ivan Kazmenko
wrote:
I can't access http://d.puremagic.com/issues/ for at least an
hour now. On a related note,
http://d.puremagic.com/test-results/ seems to be down, too.
works
I can't access http://d.puremagic.com/issues/ for at least an
hour now. On a related note,
http://d.puremagic.com/test-results/ seems to be down, too.
flag
"-L/STACK:268435456" to set it to 256 mebibytes instead). On
Linux, you can control the stack size externally with ulimit tool.
Ivan Kazmenko.
note that
the binary fraction for 1/11 has period 10, and for 1/13 the
period is 12.
Thus repeating decimal for a fraction p/q will take up to q-1
bits when we store it as a repeating decimal, but log(p)+log(q)
bits when stored as a rational number (numerator and denominator).
Ivan Kazmenko.
On Friday, 21 February 2014 at 20:27:18 UTC, Frustrated wrote:
On Friday, 21 February 2014 at 09:04:40 UTC, Ivan Kazmenko
wrote:
Thus repeating decimal for a fraction p/q will take up to q-1
bits when we store it as a repeating decimal, but
log(p)+log(q) bits when stored as a rational number
On Saturday, 22 February 2014 at 14:17:23 UTC, Ivan Kazmenko
wrote:
Sometimes there is a non-degenerate pre-period part before the
period:
13/10 = 1.0100110011 = 1.0(1001) as a binary fraction, the
"1.0" part being the pre-period and the "(1001)" part the
period. The s
debug=BinaryHeap" seems like a good way to give 2. Perhaps
the same can be done for RedBlackTree? Such checks are not
exactly unit tests, they vary from one application of a container
to another.
Ivan Kazmenko.
http://dlang.org/library
Looks nice!
I second the opinion that Disqus might have a better alternative.
Its loading after the page was rendered looks clumsy, its style
does not match that of dlang.org's... the whole thing is somehow
out of place.
Ivan Kazmenko.
nt it by actually using the cache in
between, but it still wins against my attempts so far.)
Ivan Kazmenko.
On Tuesday, 1 April 2014 at 21:34:29 UTC, Ivan Kazmenko wrote:
On Tuesday, 1 April 2014 at 18:35:50 UTC, Walter Bright wrote:
2. The latter function wins, no wonder though, since there's no
branching. (I tried to augment it by actually using the cache
in between, but it still wins ag
ng how such a bug survived until now!
Can all (meaningful) scopes of a module be numbered internally to
distinguish them? Some way, like lambdas are. Or is it too much
of a change?
If they can, the scope's unique ID can then go into the mangled
name.
Ivan Kazmenko.
Hi,
I just won a three-month-long programming contest (Al
Zimmermann's Programming Contest - Alphabet City) using the D
programming language as my main tool. I want to share my
happiness, and express my deep gratitude, to the people who work
on this tool. You are a part of what made this a
On Monday, 18 August 2014 at 07:10:02 UTC, bearophile wrote:
Ivan Kazmenko:
My contest program, now on GitHub:
https://github.com/GassaFM/alphabet-city/
dmd bug: wrong file and line for array bounds check<
Did you report the bugs?
Yeah, that one got reduced to
https://issues.dlang.
o follow.
The mechanism for inner iteration makes it convenient: just write
foreach (o; call (1) as a function)
put (2) as a body
and the body (2) is automatically converted into a delegate.
This syntax coincides with my way of thinking about the problem,
so I'm delighted to use it.
Ivan Kazmenko.
r a few weeks later, as I'm busy with other stuff until
the beginning of September.
Ivan Kazmenko.
On Monday, 18 August 2014 at 18:04:50 UTC, Ali Çehreli wrote:
On 08/18/2014 03:11 AM, Ivan Kazmenko wrote:
> my program usually hit an out-of-memory error very soon. It
> worked fine when compiled with 64-bit DMD but failed to
collect
> the garbage in time with 32-bit DMD and with r
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
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
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
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
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
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
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
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
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?
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
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?
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
faster for k close to boundary
and special inputs). So, provide the default but let the user
choose.
Ivan Kazmenko.
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
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
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
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
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.
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.
ardless of whether n is close to the
edge.
Ivan Kazmenko.
.
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.
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
e make things a bit more clear. Don't
know how much of a justification that is.
Ivan Kazmenko.
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
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
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
< 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.
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
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
front page of
dlang.org as well? It could fit under Contribute, or maybe a
separate section closer to the top.
Ivan Kazmenko.
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.
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
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
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
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
worth noting, the best place for such questions in D.learn
group:
http://forum.dlang.org/group/digitalmars.D.learn
Ivan Kazmenko.
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.
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
don't see whether it fits the larger picture, but still
think it's worth to consider.
Ivan Kazmenko.
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.
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.
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
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
on ones
(or they are just lazy). As a result, the developers don't
overuse them.
Ivan Kazmenko.
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
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
memory used will be O(n/m) too. I can put together an
example implementation if this best satisfies your requirements.
Ivan Kazmenko.
ageable.
For example, what if we put the intervals in a queue instead of a
stack?
Ivan Kazmenko.
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
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.
oup, since it's
quirky, and I may have easily missed something important.
Ivan Kazmenko.
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
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.
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
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
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.
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!
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.
scape purity), but perhaps may be applied beyond
simple debugging and profiling.
Ivan Kazmenko.
90 matches
Mail list logo