Dne 31.5.2017 v 02:13 Ali Çehreli via Digitalmars-d-learn napsal(a):
I could not make the D program come close to wc's performance when the
data was piped from stdin. A typical run with Daniel Kozak's program:
$ time cat deleteme.txt | wc -l
5062176
real0m0.086s
user0m0.068s
sys0m
On Tuesday, 30 May 2017 at 21:16:26 UTC, Oleg B wrote:
Hello. I have this code
import std.stdio;
void foo(byte a) { writeln(typeof(a).stringof); }
void foo(short a) { writeln(typeof(a).stringof); }
void foo(int a) { writeln(typeof(a).stringof); }
void main()
{
foo(0); // int, and byte if n
On Wednesday, 31 May 2017 at 04:31:14 UTC, Ivan Kazmenko wrote:
Now, where is the old version wrong? ...
Actually, it also changes every number in the string, not only
the first one as required. Because of that, it also fails the
"do not touch the exponent" requirement. Sadly, both are not
On Tuesday, 30 May 2017 at 10:54:49 UTC, Solomon E wrote:
I ran into a Rosetta code solution in D that had obvious
errors. It's like the author or the previous editor wasn't even
trying to do it right, like a protest against how many detailed
rules the task had. I assumed that's not the way we
On Tuesday, 30 May 2017 at 10:54:49 UTC, Solomon E wrote:
The earlier version of the page made D look more error prone
than other languages, but short. Now my solution is as long as
some of the other language's solutions, but it's well commented
and tested, I think. Now I doubt any of the sol
On Tuesday, 30 May 2017 at 23:41:01 UTC, H. S. Teoh wrote:
This little challenge piqued my interest. So I decided to take
a shot at seeing if I could beat my system's /usr/bin/wc -l.
First order of business: whenever it comes to performance,
always choose the right compiler for the job...
P.S. After I posted the code, I took a closer look at the disassembly
and found that gdc wasn't generating the best code for the parallel
foreach loop body. I haven't fully traced the cause yet, but I did find
a simple optimization (arguably a micro-optimization): updating the
subtotal inside the
On 05/30/2017 01:02 PM, Nitram wrote:
After reading
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i
was wondering how fast one can do a simple "wc -l" in D.
So i made a couple short implementations and found myself confronted
with slow results compared to "/usr/bin/wc -l".
On Tue, May 30, 2017 at 08:02:38PM +, Nitram via Digitalmars-d-learn wrote:
> After reading
> https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i
> was wondering how fast one can do a simple "wc -l" in D.
>
> So i made a couple short implementations and found myself confronte
On Tuesday, 30 May 2017 at 18:05:02 UTC, cym13 wrote:
On Tuesday, 30 May 2017 at 17:57:04 UTC, Lyle wrote:
Hi,
I have an associative array of type int[ulong] and I'm trying
to get the index of the maximum value, like this:
int[ulong] aa = [1UL: 2000,
2UL: 5000,
On Tuesday, 30 May 2017 at 21:42:03 UTC, Daniel Kozak wrote:
Compiler do many assumptions (it is sometimes useful).
but if compiler find one-to-one correspondence it don't make
assumptions, like here?
import std.stdio;
void f(ushort u)
{
writeln("ushort");
}
void f(ubyte u)
{
writ
Dne 30.5.2017 v 23:16 Oleg B via Digitalmars-d-learn napsal(a):
Hello. I have this code
import std.stdio;
void foo(byte a) { writeln(typeof(a).stringof); }
void foo(short a) { writeln(typeof(a).stringof); }
void foo(int a) { writeln(typeof(a).stringof); }
void main()
{
foo(0); // int, an
and this is unexpected for me too
immutable ushort y = 0;
foo(y); // byte
Hello. I have this code
import std.stdio;
void foo(byte a) { writeln(typeof(a).stringof); }
void foo(short a) { writeln(typeof(a).stringof); }
void foo(int a) { writeln(typeof(a).stringof); }
void main()
{
foo(0); // int, and byte if not define foo(int)
foo(ushort(0)); // byte (unexpect
I do not know this is my first attempt and it is almost same fast as wc
on my pc:
int main(string[] args)
{
import std.stdio : writeln, writefln, File;
import std.array : uninitializedArray;
auto f = File("data");
size_t c = 0;
auto buffer = uninitializedArray!(ubyte[])(1024
On Tuesday, 30 May 2017 at 20:37:44 UTC, Jordan Wilson wrote:
On Tuesday, 30 May 2017 at 20:02:38 UTC, Nitram wrote:
After reading
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D.
So i made a couple short implementat
On Tuesday, 30 May 2017 at 20:02:38 UTC, Nitram wrote:
After reading
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D.
So i made a couple short implementations and found myself
confronted with slow results compared to
After reading
https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/
, i was wondering how fast one can do a simple "wc -l" in D.
So i made a couple short implementations and found myself
confronted with slow results compared to "/usr/bin/wc -l".
How would a implementation look li
On Tue, May 30, 2017 at 11:10:19AM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> Yeah, basically, D's pure was originally what is now sometimes called
> "strongly pure," which is quite close to functionally pure in that the
> same input results in the same output (it still allows
On Tue, May 30, 2017 at 05:57:04PM +, Lyle via Digitalmars-d-learn wrote:
> Hi,
>
> I have an associative array of type int[ulong] and I'm trying to get
> the index of the maximum value, like this:
>
> int[ulong] aa = [1UL: 2000,
> 2UL: 5000,
> 5UL: 1000];
>
On Tuesday, May 30, 2017 16:54:13 ag0aep6g via Digitalmars-d-learn wrote:
> On 05/30/2017 11:12 AM, Rene Zwanenburg wrote:
> > If malloc were marked as pure, wouldn't that mean it must return the
> > same pointer every time you call it with the same size?
>
> D's `pure` mostly means: "does not acce
On Tuesday, 30 May 2017 at 17:57:04 UTC, Lyle wrote:
Hi,
I have an associative array of type int[ulong] and I'm trying
to get the index of the maximum value, like this:
int[ulong] aa = [1UL: 2000,
2UL: 5000,
5UL: 1000];
writeln(aa.maxIndex); // should print
On Tuesday, 6 October 2015 at 15:16:13 UTC, tcak wrote:
While writing max ulong value, I added the "u" postfix. So
compiler accepted it as ulong value (That's my interpretation
if correct on compiler's side).
writeln( 18_446_744_073_709_551_615u );
But when I try to print out minimum value of
Jonathan,
I saw this answered in another post:
http://forum.dlang.org/post/gtaublmskqrhnbhoe...@forum.dlang.org
I.e., you can do long(-9223372036854775808UL) :)
Or long l = -9223372036854775808UL;
Hi,
I have an associative array of type int[ulong] and I'm trying to
get the index of the maximum value, like this:
int[ulong] aa = [1UL: 2000,
2UL: 5000,
5UL: 1000];
writeln(aa.maxIndex); // should print 2
Can anyone help me out?
Many thanks,
Lyle
On 05/30/2017 11:12 AM, Rene Zwanenburg wrote:
If malloc were marked as pure, wouldn't that mean it must return the
same pointer every time you call it with the same size?
D's `pure` mostly means: "does not access mutable state, and does not do
input/output".
There is never a requirement tha
On Tuesday, 30 May 2017 at 13:45:07 UTC, Rene Zwanenburg wrote:
On Tuesday, 30 May 2017 at 11:34:52 UTC, ketmar wrote:
If malloc were marked as pure, wouldn't that mean it must
return the same pointer every time you call it with the same
size?
of course. but D "pure" is not what other world k
Rene Zwanenburg wrote:
On Tuesday, 30 May 2017 at 11:34:52 UTC, ketmar wrote:
If malloc were marked as pure, wouldn't that mean it must return the
same pointer every time you call it with the same size?
of course. but D "pure" is not what other world knows as "pure". we love
to mess with wor
On Tuesday, 30 May 2017 at 11:34:52 UTC, ketmar wrote:
If malloc were marked as pure, wouldn't that mean it must
return the same pointer every time you call it with the same
size?
of course. but D "pure" is not what other world knows as
"pure". we love to mess with words.
Well, there's the
I had post question here
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/43511/
Rene Zwanenburg wrote:
On Monday, 29 May 2017 at 01:36:24 UTC, Jonathan M Davis wrote:
A simple example: anything that has a malloc/free pair.
Yeah, if you do it right, you should be fine, but you have to do it
right, and it's very easy to miss some detail that makes it wrong to
insist to t
http://forum.dlang.org/post/xpmpakmusudanwuzz...@forum.dlang.org
https://issues.dlang.org/show_bug.cgi?id=9631
On Tue, May 30, 2017 at 1:07 PM, Biotronic via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 30 May 2017 at 10:46:12 UTC, Andrew Edwards wrote:
>
>> On Tu
On Tuesday, 30 May 2017 at 10:46:12 UTC, Andrew Edwards wrote:
On Tuesday, 30 May 2017 at 10:37:58 UTC, Biotronic wrote:
On Tuesday, 30 May 2017 at 10:31:24 UTC, Daniel Kozak wrote:
import std.traits : fqn = fullyQualifiedName;
Darnit. I just googled the template and got a result talking
abo
I ran into a Rosetta code solution in D that had obvious errors.
It's like the author or the previous editor wasn't even trying to
do it right, like a protest against how many detailed rules the
task had. I assumed that's not the way we want to do things in D.
Then I spent all day fixing it. O
On Tuesday, 30 May 2017 at 10:37:58 UTC, Biotronic wrote:
On Tuesday, 30 May 2017 at 10:31:24 UTC, Daniel Kozak wrote:
import std.traits : fqn = fullyQualifiedName;
Darnit. I just googled the template and got a result talking
about fqn!T. So yeah - this code:
import std.traits;
pragma(msg,
On Tuesday, 30 May 2017 at 10:31:24 UTC, Daniel Kozak wrote:
import std.traits : fqn = fullyQualifiedName;
Darnit. I just googled the template and got a result talking
about fqn!T. So yeah - this code:
import std.traits;
pragma(msg, fullyQualifiedName!ImVec2);
pragma(msg, fullyQualifiedName
On Tuesday, 30 May 2017 at 10:20:53 UTC, Andrew Edwards wrote:
Sorry, rough day. Could someone please explain what this means
and how do go about resolving it?
Thanks,
Andrew
If you want to resolve it just do
const label_size = CalcTextSize(...);
but as others have mentioned make sure i
import std.traits : fqn = fullyQualifiedName;
On Tue, May 30, 2017 at 12:24 PM, Biotronic via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 30 May 2017 at 10:09:50 UTC, Andrew Edwards wrote:
>
>> What does that even mean?
>>
>> Scenario:
>>
>> bool func(const ImVec
On Tuesday, 30 May 2017 at 10:09:50 UTC, Andrew Edwards wrote:
What does that even mean?
Scenario:
bool func(const ImVec2 label_size)
{
return true;
}
void main()
{
//first attempt:
const ImVec2 label_size = CalcTextSize(label.ptr, null,
true);
//Error: cannot implicitly conve
Sorry, rough day. Could someone please explain what this means
and how do go about resolving it?
Thanks,
Andrew
It seems there are two different ImVec2 types. So ImVec2 is not same as ImVec2
:)
On Tue, May 30, 2017 at 12:09 PM, Andrew Edwards via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> What does that even mean?
>
> Scenario:
>
> bool func(const ImVec2 label_size)
> {
> return
What does that even mean?
Scenario:
bool func(const ImVec2 label_size)
{
return true;
}
void main()
{
//first attempt:
const ImVec2 label_size = CalcTextSize(label.ptr, null, true);
//Error: cannot implicitly convert expression
(CalcTextSize(cast(immutable(char)*)label, null, t
On Monday, 29 May 2017 at 01:36:24 UTC, Jonathan M Davis wrote:
A simple example: anything that has a malloc/free pair.
Yeah, if you do it right, you should be fine, but you have to
do it right, and it's very easy to miss some detail that makes
it wrong to insist to the compiler that what you
On Friday, 26 May 2017 at 15:17:08 UTC, drug wrote:
Trying to bind to cpp code I stop at some moment having
undefined reference to some cpp function. But objdump -Ct
cpplibrary.so shows me that this cpp function exists in the
library. linker message about cpp function is _identical_ to
objdump
44 matches
Mail list logo