W dniu 06.11.2012 04:43, Nick Sabalausky pisze:
What kind of memory overhead is there for a fiber?
At least one PAGESIZE (typically 4KB):
https://github.com/D-Programming-Language/druntime/blob/master/src/core/thread.d#L3828
Chopin wrote:
Hello!
I got this 109 MB json file that I read... and it takes over 32
seconds for parseJSON() to finish it. So I was wondering if it
was a way to save it as binary or something like that so I can
read it super fast?
Thanks for all suggestions :)
Try this implementation:
Chopin wrote:
Thanks! I tried using it:
auto document = parseJSON(content).array; // this works with std.json :)
Using json.d from the link:
auto j = JSONReader!string(content);
auto document = j.value.whole.array; // this doesn't Error:
undefined identifier 'array'
If you're sure that
Jonathan M Davis wrote:
On Thursday, July 26, 2012 21:09:09 Chad J wrote:
I keep hearing that scope variables are going away. I missed the
discussion on it. Why is this happening?
When I read about this, I have these in mind:
void someFunc()
{
// foo is very likely to get stack
bearophile wrote:
Piotr Szturmaj:
It seems that we ended up with a solution that was meant to fix a
language builtin but appears to be worse than that.
This is true, currently the library solution is worse (more dangerous
and more broken) than the precedent built-in feature
Jonathan M Davis wrote:
On Wednesday, October 10, 2012 17:04:41 Piotr Szturmaj wrote:
Jonathan M Davis wrote:
On Thursday, July 26, 2012 21:09:09 Chad J wrote:
I keep hearing that scope variables are going away. I missed the
discussion on it. Why is this happening?
When I read about this, I
Jonathan M Davis wrote:
On Thursday, October 11, 2012 01:24:40 Piotr Szturmaj wrote:
Could you give me an example of preventing closure allocation? I think I
knew one but I don't remember now...
Any time that a delegate parameter is marked as scope, the compiler will skip
allocating a closure
Zhenya wrote:
Hi!
I need to load some textures for my game,but I woud like to do it in
compile time.
I know that CTFE imposes restrictions on functions.So can I execute some
DevIL(Derelict3) functions?
CTFE can only evaluate D functions that have their bodies available. It
means that external
ref2401 wrote:
import std.range;
int[] numbers = [1, 3, 5, 7, 9, 11];
auto rangeObject = inputRangeObject(numbers);
auto inputRange = cast(InputRange!(int[]))rangeObject;
why does 'inputRange' equal null?
Because you specified int[] element type and cast operator returns null
when objects
Hi,
I found this code of std.range.iota's Result struct:
@property inout(Value) front() inout { assert(!empty); return
current; }
What's the purpose of inout on parameterless functions?
Timon Gehr wrote:
On 08/24/2012 12:14 AM, Piotr Szturmaj wrote:
Hi,
I found this code of std.range.iota's Result struct:
@property inout(Value) front() inout { assert(!empty); return
current; }
What's the purpose of inout on parameterless functions?
It is a method of a struct
Artur Skawina wrote:
On 04/15/12 03:01, Piotr Szturmaj wrote:
Artur Skawina wrote:
@property is for functions masquerading as data, i'm not sure extending it
to pointers and delegates would be a good idea. What you are asking for is
basically syntax sugar for:
struct CommonInputRange(E
Jonathan M Davis wrote:
On Saturday, April 14, 2012 20:47:20 Piotr Szturmaj wrote:
struct CommonInputRange(E)
{
@property bool delegate() empty;
@property E delegate() front;
void delegate() popFront;
}
front returns an element in the range. In your case, it's returning
I have following code:
import std.array, std.range, std.stdio;
struct CommonInputRange(E)
{
@property bool delegate() empty;
@property E delegate() front;
void delegate() popFront;
}
void main(string[] args)
{
alias CommonInputRange!dchar DCRange;
static
Kevin Cox wrote:
I would reccomend Qt as well. You will get native cross-platform
widgets with great performance. I am not sure how far QtD is but I know
it once had a lot of development on it.
AFAIR, QtD is at the alpha stage. It's based on QtJambi, but there is
another SMOKE generator,
Nicolas Silva wrote:
On Sat, Mar 31, 2012 at 12:25 PM, Piotr Szturmajbncr...@jadamspam.pl wrote:
I have written streaming json parser using ranges. It returns slices when
possible. Benchmarked it and it's about 2.05x the speed of std.json.
It gives possibility to dig into the structure and
Andrej Mitrovic wrote:
On 12/1/11, Kai Meyerk...@unixlords.com wrote:
I'm finding std.json extremely well written, with one glaring exception.
I'm finding it to be crap. The last time I used it I just kept getting
access violations (or was that std.xml? They're both crap when I used
them.).
Jonathan M Davis wrote:
On Friday, March 02, 2012 20:41:35 Ali Çehreli wrote:
On 03/02/2012 06:30 PM, Piotr Szturmaj wrote:
Hello,
For this code:
auto c = testc;
auto w = testw;
auto d = testd;
pragma(msg, typeof(c.front));
pragma(msg, typeof(w.front
Hello,
For this code:
auto c = testc;
auto w = testw;
auto d = testd;
pragma(msg, typeof(c.front));
pragma(msg, typeof(w.front));
pragma(msg, typeof(d.front));
compiler prints:
dchar
dchar
immutable(dchar)
IMO it should print this:
immutable(char)
immutable(wchar)
Is there a plan to replace streams with byte ranges? Or should I just
use streams?
I need to do some binary parsing and I found using ranges is not very
comfortable. For example to read an uint I need to:
version (LittleEndian)
auto r = retro(takeExactly(range, 4));
else
auto r =
Don Clugston wrote:
On 13/01/12 10:01, k2 wrote:
When replace typedef to enum, it became impossible to compile a certain
portion.
dmd v2.057 Windows
enum HANDLE : void* {init = (void*).init}
pure HANDLE int_to_HANDLE(int x)
{
return
Jonathan M Davis wrote:
On Friday, January 13, 2012 12:17:06 Piotr Szturmaj wrote:
Is there a plan to replace streams with byte ranges? Or should I just
use streams?
At some point, std.stream will be replace with a range-based API. There has
been some discussion on the design, but it hasn't
Jorge wrote:
My first question si very silly:
string str = readln()
my input is for example 123
how can i convert this to an integer?
import std.conv;
// then in code:
auto i = to!int(str);
Zardoz wrote:
const num = 10;
foreach (t; 0..num) {
foreach(i, ref elem; taskPool.parallel(logs, 100)) {
elem = log(i + 1.0);
}
}
I think you just spawned 10 tasks. Look at foreach (t; 0..num).
I want to make a delegate of blocking I/O statement and pass it to a
function. Then it will be called immediately. This delegate never
escapes its creation scope, so I don't want heap closure allocation.
Will compiler create dynamic closure (e.g. with allocation) or static
closure (with
Mariusz Gliwiński wrote:
I'll clarify myself:
All i would need is extending - without polymorphism.
Containment, can be solution for fields which doesn't annoys so much
(although image in auto-generated documentation, just like it's with
subclassing, would be nice).
Unfortunately, the worse case
%u wrote:
is there any different b/w:
auto arr = new int[10];
arr is dynamic array of int with ten elements
and
int[10] arr;
?
arr is static array of int with ten elements
Is it possible to add a particular number of days to a Date?
I have number of days since 1 Jan 2000 and I want to convert it to Date:
int days = read!int; // number of days since 1 Jan 2000
Date x = Date(2000, 1, 1);
x.add!days(days);
Unfortunately add() does not support adding days. Will it
Steven Schveighoffer wrote:
On Thu, 07 Apr 2011 15:07:02 -0400, Piotr Szturmaj
bncr...@jadamspam.pl wrote:
Is it possible to add a particular number of days to a Date?
I have number of days since 1 Jan 2000 and I want to convert it to Date:
int days = read!int; // number of days since 1 Jan
I wrote simple template to test VariantN type (and thus Algebraic and
Variant).
template isVariantN(T)
{
static if (is(T X == VariantN!(N, Types), uint N, Types...))
enum isVariantN = true;
else
enum isVariantN = false;
}
but testing against
Shouldn't dynamic array be reference type?
uint[][uint] aa;
uint[] temp;
aa[5] = new uint[0];
temp = aa[5]; // copy uint[] reference
temp ~= 1;
assert(temp.length == 1 temp[0] == 1); // pass
assert(aa[5].length == 1 aa[5][0] == 1); // fail
Is this a bug?
Thank you for your very complete answers :)
I was trying to avoid multiple AA key lookups while appending many
elements to dynamic array. It's clear now, that with D2 semantics it's
better to first build an array and then assign it to AA.
Why this works:
struct Test
{
int read()
{
return 5;
}
int[] readArray()
{
int[] readDim()
{
return [read(), read()];
}
return
How cool. Very glad you're going native D. I've used Npgsql a lot
and also the more standard data.sqlclient interface from c# so I'm
happy you're modeling after that API. In your general API, will
you support the more advanced features like creating functions,
refcursors, preplanning queries,
Ellery Newcomer wrote:
auto a = 1, b = null;
int a = 1, *b = null;
The first is accepted by dmd, and it should result in typeof(a) == int
and typeof(b) == void*. It is somewhat contradictory to the error
message resulting from the second:
multiple declarations must have the same type, not
I was wondering if there is a postgresql db (D native) interface
available for D2?
Hi,
I'm currently writing one for D2 using postgresql's low level protocol
directly (instead of using libpq). It supports binary formatting, so no
parsing or converting to string/escaping is needed and that
I was wondering if there is a postgresql db (D native) interface
available for D2?
Hi,
I'm currently writing one for D2 using postgresql's low level protocol
directly (instead of using libpq). It supports binary formatting, so no
parsing or converting to string/escaping is needed and that
Hello,
I'm using D2.051 and following code:
import std.variant;
template Nullable(T)
{
alias Algebraic!(T, void*) Nullable;
}
template isNullable(T)
{
static if (is(T X == Nullable!U, U))
enum isNullable = true;
else
enum isNullable = false;
}
static
Simen kjaeraas wrote:
Piotr Szturmaj bncr...@jadamspam.pl wrote:
static assert(isNullable!(Nullable!int));
Question is, what I'm doing wrong?
The problem here is that Nullable!T is not a real type. Hence,
Nullable!int is actually
Algebraic!(int,void*). Checking for that apparently does
39 matches
Mail list logo