Re: Linus with some good observations on garbage collection

2011-04-22 Thread Timon Gehr
Ulrik Mikaelsson wrote: > All in all, I think the best approach is a pragmatic one, where > different types of resources can be handled according to different > schemes. > > I.E. default to GC-manage everything. After profiling, determining > what resources are mostly used, and where, optimize allo

Re: Temporarily disable all purity for debug prints

2011-04-22 Thread Andrew Wiley
On Fri, Apr 22, 2011 at 12:34 AM, dennis luehring wrote: > On 17.04.2011 22:45, Andrew Wiley wrote: > >> On Sun, Apr 17, 2011 at 3:30 PM, dennis luehring >> wrote: >> >>> On 11.04.2011 23:27, bearophile wrote: >>> From what I am seeing, in a D2 program if I have many (tens or more) >>

Re: OOP, faster data layouts, compilers

2011-04-22 Thread bearophile
Sean Cavanaugh: > In C++ the intrinsics are easily wrapped by __forceinline global > functions, to provide a platform abstraction against the intrinsics. When AVX will become 512 bits wide, or you need to use a very different set of vector register, your global functions need to change, so the c

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Sean Cavanaugh
On 4/22/2011 4:41 PM, bearophile wrote: Sean Cavanaugh: In many ways the biggest thing I use regularly in game development that I would lose by moving to D would be good built-in SIMD support. The PC compilers from MS and Intel both have intrinsic data types and instructions that cover all the

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Ulrik Mikaelsson
2011/4/22 Timon Gehr : > That is only a problem if the reference count of that resource changes at a > very > high frequency. The described problem also implies that the threads would not > need > any form of synchronization for the data (otherwise the reference count > certainly > would not be

Re: Transients or scoped immutability

2011-04-22 Thread bearophile
Jesse Phillips: > To me it sounds really nice an clean, do you think it would work for you? Maybe you have missed the last two lines of my post: > This idea is good and it will help, but it needs a function call: > http://d.puremagic.com/issues/show_bug.cgi?id=5081 I like that idea and I think

Re: Transients or scoped immutability

2011-04-22 Thread Jesse Phillips
bearophile Wrote: > This post contains uncooked ideas. > > I'd like to create data structures: > - That once created are immutable, so there is no risk to write on them, etc; > - On the stack too, avoiding slower heap allocations and avoiding copying > them from the mutable to the immutable vers

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Mike Parker
On 4/23/2011 4:22 AM, Andrew Wiley wrote: The reason Minecraft runs so well in Java, from my point of view, is that the authors resisted the Java urge to throw objects at the problem and instead put everything into large byte arrays and wrote methods to manipulate them. From that perspectiv

Re: Linus with some good observations on garbage collection

2011-04-22 Thread bearophile
> Now D I prefer something better than C99 VLAs. I'd like D-VLAs with the same > syntax as C99 VLAs but with a safer semantics, Never mind, that semantics can't use that syntax, otherwise you have hidden heap allocations... The syntax has to change (because the D-VLA semantics seems OK to me).

Re: Linus with some good observations on garbage collection

2011-04-22 Thread bearophile
Iain Buclaw: > Variable length arrays are just sugary syntax for a call to alloca. I have an enhancement request in Bugzilla on VLA, with longer discussions. Just two comments: - It seems alloca() can be implemented with two different semantics: to deallocate at the end of the function or to de

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Iain Buclaw
== Quote from bearophile (bearophileh...@lycos.com)'s article > Timon Gehr: > > But, as pointed out by Linus, the prime performance problem is _not_ the > > GC, but > > the mindset that comes with it. Most programmers that "grew up" in a managed > > environment tend to use very many "new" keywords

Re: OOP, faster data layouts, compilers

2011-04-22 Thread bearophile
Sean Cavanaugh: > In many ways the biggest thing I use regularly in game development that > I would lose by moving to D would be good built-in SIMD support. The PC > compilers from MS and Intel both have intrinsic data types and > instructions that cover all the operations from SSE1 up to AVX. T

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Sean Cavanaugh
On 4/22/2011 2:20 PM, bearophile wrote: Kai Meyer: The purpose of the original post was to indicate that some low level research shows that underlying data structures (as applied to video game development) can have an impact on the performance of the application, which D (I think) cares very mu

Transients or scoped immutability

2011-04-22 Thread bearophile
This post contains uncooked ideas. I'd like to create data structures: - That once created are immutable, so there is no risk to write on them, etc; - On the stack too, avoiding slower heap allocations and avoiding copying them from the mutable to the immutable version; - Avoiding to keep in the

Re: Linus with some good observations on garbage collection

2011-04-22 Thread bearophile
Timon Gehr: > But, as pointed out by Linus, the prime performance problem is _not_ the GC, > but > the mindset that comes with it. Most programmers that "grew up" in a managed > environment tend to use very many "new" keywords all over their code, instead > of > allocating large chunks of memory

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Timon Gehr
Brad Roberts wrote: > Also add to it that in many cases you're dealing with a threaded environment, > > so those refcounts have to be locked > (either via mutexes, or more commonly just atomic) operations which are far > more expensive than non-atomic. More so > when there's actual contention fo

Re: using dylib with dmd

2011-04-22 Thread frostmind
Thank you for your response! Hopefully I've done it right. Now when everything is within the same folder, and I execute: dmd test_d_client.d -L. (so I'm telling to look for libs in current dir) Response is now different: ld: in ., can't map file, errno=22 collect2: ld returned 1 exit status ---

Re: using dylib with dmd

2011-04-22 Thread Jesse Phillips
frostmind Wrote: > And now, when I execute: dmd test_d_client.d I get following output: > > Undefined symbols: > "_addRating", referenced from: > __Dmain in test_d_client.o > "_ratings", referenced from: > __Dmain in test_d_client.o > ld: symbol(s) not found > collect2: ld returne

using dylib with dmd

2011-04-22 Thread frostmind
Greetings every one, I desperatly searched net about how to compile a d2 program that uses dylib on mac os, but unfortunately no luck. What I've been doing: I have a C library compiled as (taken from http://developer.apple.com/): gcc -dynamiclib -std=gnu99 Ratings.c -current_version 0.1 -compat

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Andrew Wiley
On Fri, Apr 22, 2011 at 12:31 PM, Kai Meyer wrote: > On 04/22/2011 11:20 AM, Daniel Gibson wrote: > >> Am 22.04.2011 19:11, schrieb Kai Meyer: >> >>> On 04/22/2011 11:05 AM, Daniel Gibson wrote: >>> Am 22.04.2011 18:48, schrieb Kai Meyer: > > I don't think C# is the next C++; it

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Brad Roberts
Also add to it that in many cases you're dealing with a threaded environment, so those refcounts have to be locked (either via mutexes, or more commonly just atomic) operations which are far more expensive than non-atomic. More so when there's actual contention for the refcounted resource. On 4

Re: OOP, faster data layouts, compilers

2011-04-22 Thread bearophile
Kai Meyer: > The purpose of the original post was to indicate that some low level > research shows that underlying data structures (as applied to video game > development) can have an impact on the performance of the application, > which D (I think) cares very much about. The idea of the origi

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Steven Schveighoffer
On Fri, 22 Apr 2011 14:32:06 -0400, Alvaro wrote: El 22/04/2011 19:36, Walter Bright escribió: http://gcc.gnu.org/ml/gcc/2002-08/msg00552.html I've always been surprised when discussions usually just bring garbage collection as the only alternative to explicit manual memory management. I

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Michael Stover
This sort of reference count with cyclic dependency detector is how a lot of scripting languages do it, or did it in the past. The problem was that lazy generational GCs are believed to have better throughput in general. I'd like to say "were proved" rather than "are believed", but I don't actual

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Alvaro
El 22/04/2011 19:36, Walter Bright escribió: http://gcc.gnu.org/ml/gcc/2002-08/msg00552.html I've always been surprised when discussions usually just bring garbage collection as the only alternative to explicit manual memory management. I imagined it as a garbage truck that has its own schedu

Re: Linus with some good observations on garbage collection

2011-04-22 Thread Andrej Mitrovic
Just a reminder: that post is 9 years old.

Linus with some good observations on garbage collection

2011-04-22 Thread Walter Bright
http://gcc.gnu.org/ml/gcc/2002-08/msg00552.html

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Kai Meyer
On 04/22/2011 11:20 AM, Daniel Gibson wrote: Am 22.04.2011 19:11, schrieb Kai Meyer: On 04/22/2011 11:05 AM, Daniel Gibson wrote: Am 22.04.2011 18:48, schrieb Kai Meyer: I don't think C# is the next C++; it's impossible for C# to be what C/C++ is. There is a purpose and a place for Interprete

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Daniel Gibson
Am 22.04.2011 19:11, schrieb Kai Meyer: > On 04/22/2011 11:05 AM, Daniel Gibson wrote: >> Am 22.04.2011 18:48, schrieb Kai Meyer: >>> >>> I don't think C# is the next C++; it's impossible for C# to be what >>> C/C++ is. There is a purpose and a place for Interpreted languages like >>> C# and Java,

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Kai Meyer
On 04/22/2011 11:05 AM, Daniel Gibson wrote: Am 22.04.2011 18:48, schrieb Kai Meyer: I don't think C# is the next C++; it's impossible for C# to be what C/C++ is. There is a purpose and a place for Interpreted languages like C# and Java, just like there is for C/C++. What language do you think

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Daniel Gibson
Am 22.04.2011 18:48, schrieb Kai Meyer: > > I don't think C# is the next C++; it's impossible for C# to be what > C/C++ is. There is a purpose and a place for Interpreted languages like > C# and Java, just like there is for C/C++. What language do you think > the interpreters for Java and C# are w

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Kai Meyer
On 04/22/2011 02:55 AM, Paulo Pinto wrote: Many thanks for the links, they provide very nice discussions. Specially the link below, that you can follow from your first link, http://c0de517e.blogspot.com/2011/04/2011-current-and-future-programming.html But in what concerns game development, D2 m

Re: link from a dll to another function in another dll?

2011-04-22 Thread maarten van damme
That example was a bit incomplete, preceding was the following code: import std.c.windows.windows; import core.dll_helper; pragma(lib,"kernel33.lib"); __gshared HINSTANCE g_hInst; extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) { switch (ulReason) {

Re: opDispatch, duck typing, and error messages

2011-04-22 Thread spir
On 04/22/2011 03:53 AM, Robert Jacques wrote: On Thu, 21 Apr 2011 18:24:55 -0400, Adam D. Ruppe wrote: [snip] Or, there's a whole new approach: e) Duck typing for ranges in to!() might be a bad idea. Again, remember, a class might legitimately offer a range interface, so it would trigger this

Re: opDispatch, duck typing, and error messages

2011-04-22 Thread spir
On 04/22/2011 01:25 AM, Adam D. Ruppe wrote: bearophile wrote: Maybe exceptions nature should be changed a little so they store __FILE__ and __LINE__ on default (exceptions without this information are kept on request, for optimization purposes). I'd like that. Even with a stack trace, it's

Re: opDispatch, duck typing, and error messages

2011-04-22 Thread spir
On 04/22/2011 12:24 AM, Adam D. Ruppe wrote: I just made an innocent little change to one of my programs, hit compile, and got this vomit: /home/me/d/dmd2/linux/bin/../../src/phobos/std/conv.d(97): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S, T)&& isSomeString!(T)&& isInput

Re: std.parallelism: VOTE IN THIS THREAD

2011-04-22 Thread Fawzi Mohamed
YES it is a step in the right direction, I have ome comments, but I will put them in another thread

Re: Implementing std.log

2011-04-22 Thread Zz
I currently use the logger written by Masahiro Nakagawa and it has handled what I need. You can get it from: http://www.bitbucket.org/repeatedly/scrap/src/tip/logger.d Zz Robert Clipsham Wrote: > Hey folks, > > I've just finished porting my web framework from D1/Tango to D2/Phobos, > and in

Re: OOP, faster data layouts, compilers

2011-04-22 Thread Paulo Pinto
Many thanks for the links, they provide very nice discussions. Specially the link below, that you can follow from your first link, http://c0de517e.blogspot.com/2011/04/2011-current-and-future-programming.html But in what concerns game development, D2 might already be too late. I know a bit of it