Could somebody share his thoughts on the subject?
Would it be efficient? Is it possible to avoid memory copying to provide
immutability? To avoid cache missing ring buffer should be like array,
not list, so it's possible that the whole buffer should be moved. Is it
neccessary to be real
On Wednesday, 27 May 2015 at 08:42:01 UTC, zhmt wrote:
When I enable the --profle, get something like this, it doesnt
give me too much help:
[...]
Tried callgrind and kcachegrind? If nothing else it's better at
illustrating the same output, assuming you have graphviz/dot
installed.
Given
On Wednesday, 27 May 2015 at 09:39:42 UTC, Anonymouse wrote:
On Wednesday, 27 May 2015 at 08:42:01 UTC, zhmt wrote:
When I enable the --profle, get something like this, it doesnt
give me too much help:
[...]
Tried callgrind and kcachegrind? If nothing else it's better at
illustrating the
When I enable the --profle, get something like this, it doesnt
give me too much help:
Timer Is 3579545 Ticks/Sec, Times are in Microsecs
Num TreeFuncPer
CallsTimeTimeCall
1298756 4996649885 49875773773840
On 27.05.2015 11:04, thedeemon wrote:
This whole idea sounds self-contradictory.
Ring buffer is a mutable-array-based implementation of something, for
example of a queue. You can ask about immutable implementations of a
queue, but that would be another question, not involving a ring buffer.
@jklp
And also you could try to surround the whole block with
`GC.disable` and `GC.enable`. This would help to determine if
the GC is involved:
---
Ptr!Conn conn = connect(127.0.0.1,8881);
GC.disable;
ubyte[100] buf;
string str;
for(int i=0; iN; i++)
{
str = format(%s,i);
On Wed, 27 May 2015 09:20:52 +
drug via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Could somebody share his thoughts on the subject?
Would it be efficient? Is it possible to avoid memory copying to
provide immutability? To avoid cache missing ring buffer should be
like
On Wednesday, 27 May 2015 at 10:24:59 UTC, zhmt wrote:
@Anonymouse
Thank u very much, I have tried this:
valgrind --tool=callgrind ./gamelibdtest
callgrind_annotate callgrind.out.29234
Ir
This whole idea sounds self-contradictory.
Ring buffer is a mutable-array-based implementation of something,
for example of a queue. You can ask about immutable
implementations of a queue, but that would be another question,
not involving a ring buffer.
What do you want to do with this
What happened when the code changes a little? Who will give an
explaination,Thanks a lot?
what happend if you use sformat instead?
Ptr!Conn conn = connect(127.0.0.1,8881);
ubyte[100] buf;
char[100] buf2;
for(int i=0; iN; i++)
{
auto str = sformat(buf2, %s,i);
If I pass a timeout with 1ms to epoll_wait,the cpu will not be
busy when throughput falls down.
It seems that dlang library is not so effient?
On 27.05.2015 11:10, Daniel Kozák via Digitalmars-d-learn wrote:
On Wed, 27 May 2015 09:20:52 +
drug via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Could somebody share his thoughts on the subject?
Would it be efficient? Is it possible to avoid memory copying to
provide
On 5/27/15 2:42 AM, zhmt wrote:
When I enable the --profle, get something like this, it doesnt give me
too much help:
I don't see any GC function here, I don't think you are are focusing on
the right portion of the code. Seems like the gamelib library is
consuming all the time. You may want
Check this example:
http://dpaste.dzfl.pl/53f85bae4382
Calling with null, both c-tor match.
Is there a way to solve this?
Something like:
this(in ubyte* data) if( ??? )
{
}
Andrea
On Wednesday, 27 May 2015 at 10:27:08 UTC, zhmt wrote:
It seems that dlang library is not so effient?
The gamelibd could be doing a lot more than just echoing... it
sounds to me that your socket might be blocking and epoll is busy
looping waiting for it to become available again.
On 5/27/15 1:55 AM, Gr8Ape wrote:
I'm writing a program that handles lots of slices of larger
arrays. I need the data of each of them all together for one
operation, but otherwise it's more convenient to handle the
elements in small groups. I could just store a pointer to my
array, an offset,
I am trying to use a Container class with a custom predicate, but
the following code does not compile. Any hints on how to do it?
import std.container;
class C
{
int[] prio;
RedBlackTree!(int, (a,b)=prio[a]prio[b]) tree;
}
I think I understand the reason why this does not work (the
Two options:
1) add an overload that takes typeof(null)
this(typeof(null)) { /* handles the null literal specially */ }
2) Cast null to a specific type when making it:
new YourClass(cast(ubyte*) null);
On 5/27/15 9:59 AM, Meta wrote:
I thought unaryFun *does* work with all callables, including
structs/classes with opCall?
It (binaryFun actually) declares an alias. But you need an actual
instance to use in this case. You simply can't declare that in a type
definition, and it won't be set
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
The code you posted is the client code, but the issue seems to be
on the server side.
Can you post the server code and also the timing code?
On Wednesday, 27 May 2015 at 07:55:29 UTC, Gr8Ape wrote:
You can keep an index and a count instead of a slice.
If you know your data well, you can exploit this knowledge, and
this has the potential to save you many bytes per slice when
dealing with large data sets.
Depending on your access
On 5/27/15 9:11 AM, Simon =?UTF-8?B?QsO8cmdlciI=?=
simon.buer...@rwth-aachen.de wrote:
On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote:
Do you want to dynamically change priority?
Actually yes. In my actual code I am not using a RedBlackTree but my own
Container (a heap with the
On 05/27/2015 05:30 PM, Steven Schveighoffer wrote:
On 5/27/15 9:11 AM, Simon =?UTF-8?B?QsO8cmdlciI=?=
simon.buer...@rwth-aachen.de wrote:
On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote:
Do you want to dynamically change priority?
Actually yes. In my actual code I am not using a
On Wednesday, 27 May 2015 at 15:30:28 UTC, Steven Schveighoffer
wrote:
On 5/27/15 9:11 AM, Simon =?UTF-8?B?QsO8cmdlciI=?=
simon.buer...@rwth-aachen.de wrote:
On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote:
Do you want to dynamically change priority?
Actually yes. In my actual code I am
The first answer is the one I was looking for. Very useful.
You should add to next this week in d tips.
On Wednesday, 27 May 2015 at 14:09:48 UTC, Adam D. Ruppe wrote:
Two options:
1) add an overload that takes typeof(null)
this(typeof(null)) { /* handles the null literal specially */ }
2)
On 27.05.2015 13:50, Simon Bürger simon.buer...@rwth-aachen.de wrote:
I am trying to use a Container class with a custom predicate, but the
following code does not compile. Any hints on how to do it?
import std.container;
class C
{
int[] prio;
RedBlackTree!(int, (a,b)=prio[a]prio[b])
On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote:
Do you want to dynamically change priority?
Actually yes. In my actual code I am not using a RedBlackTree but
my own Container (a heap with the possibility to modify elements
inside), which is notified when prio changes so it can do a
On Wed, 27 May 2015 14:09:47 +, Adam D. Ruppe wrote:
Two options:
1) add an overload that takes typeof(null)
this(typeof(null)) { /* handles the null literal specially */ }
you keep breaking my box of thinking. ;-) never thought about such
declaration.
signature.asc
Description: PGP
On Wednesday, 27 May 2015 at 17:56:27 UTC, Steven Schveighoffer
wrote:
On 5/27/15 9:59 AM, Meta wrote:
I thought unaryFun *does* work with all callables, including
structs/classes with opCall?
It (binaryFun actually) declares an alias. But you need an
actual instance to use in this case.
On Wednesday, 27 May 2015 at 19:38:16 UTC, ketmar wrote:
On Wed, 27 May 2015 14:09:47 +, Adam D. Ruppe wrote:
Two options:
1) add an overload that takes typeof(null)
this(typeof(null)) { /* handles the null literal specially */ }
you keep breaking my box of thinking. ;-) never thought
On 05/27/2015 10:09 PM, Meta wrote:
On Wednesday, 27 May 2015 at 19:38:16 UTC, ketmar wrote:
On Wed, 27 May 2015 14:09:47 +, Adam D. Ruppe wrote:
Two options:
1) add an overload that takes typeof(null)
this(typeof(null)) { /* handles the null literal specially */ }
you keep breaking
On Wednesday, 27 May 2015 at 05:51:21 UTC, zhmt wrote:
I noticed that the cpu% falls from 99% down to 4% as well when
the throughput falls down.
I tried again for several times, the cpu is still busy, 98.9%.
I think it is not problem of gc, it is my fault:
The operations is serialized:
clent send - server recv - server send - client recv,
so if one operation takes too long time, the throughput will
definitely fall down.
I cant explain why it so fast when buffer is big enough, and so
low when
On Wednesday, 27 May 2015 at 19:04:53 UTC, Márcio Martins wrote:
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
The code you posted is the client code, but the issue seems to
be on the server side.
Can you post the server code and also the timing code?
@Márcio Martins
here is
I have some code that I'd really like to template-ize.
Currently, I've the same construct all over my code, repeated(yet
slightly different) about 15 times.
Too much for me, and I'd like to make it into a template.
This is a sample of my current code:
http://dpaste.dzfl.pl/76814846898e
I
On Wed, 27 May 2015 22:49:18 +, ketmar wrote:
i.e. `constructCases~(Aliases[2..$])`
`constructCases!(Aliases[2..$])`, of course ;-)
signature.asc
Description: PGP signature
On Wed, 27 May 2015 22:35:54 +, wobbles wrote:
quick looking thru your code raises two questions:
1. didn't you forgot to add `.stringof` in `constructCases`?
2. didn't you forgot `!` in `constructCases(Aliases[2..$])`?
i.e. `constructCases~(Aliases[2..$])`
it may work with that.
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
What happened when the code changes a little? Who will give an
explaination,Thanks a lot?
Yes, on the first sight it looks like your allocations in the
loop make GC spend too much time. I don't think scope does
anything here. Try adding
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
I am writing a echoclient, as below:
Ptr!Conn conn = connect(127.0.0.1,8881);
ubyte[100] buf;
for(int i=0; iN; i++)
{
scope string str = format(%s,i);
conn.write((cast(ubyte*)str.ptr)[0..str.length]);
On Wed, 27 May 2015 05:48:11 +
zhmt via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I am writing a echoclient, as below:
Ptr!Conn conn = connect(127.0.0.1,8881);
ubyte[100] buf;
for(int i=0; iN; i++)
{
scope string str = format(%s,i);
I'm writing a program that handles lots of slices of larger
arrays. I need the data of each of them all together for one
operation, but otherwise it's more convenient to handle the
elements in small groups. I could just store a pointer to my
array, an offset, and a length but since I'm using D
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
I am writing a echoclient, as below:
Ptr!Conn conn = connect(127.0.0.1,8881);
ubyte[100] buf;
for(int i=0; iN; i++)
{
scope string str = format(%s,i);
conn.write((cast(ubyte*)str.ptr)[0..str.length]);
43 matches
Mail list logo