Re: Bye bye, fast compilation times

2018-02-06 Thread Andres Clari via Digitalmars-d

On Wednesday, 7 February 2018 at 00:36:22 UTC, H. S. Teoh wrote:
On Tue, Feb 06, 2018 at 11:20:53PM +, Andres Clari via 
Digitalmars-d wrote: [...]

[...]


I seem to vaguely recall that in some cases, ctRegex might even 
perform slower than regex().  But either way, my use cases for 
regexes generally aren't performance-sensitive enough to be 
worth the trouble of huge compilation time slowdown -- I just 
use regex() instead of ctRegex.



[...]

[...]


That depends on what you're doing with it, and also how you're 
building it. 3500+ lines isn't a lot of code; it ought to 
compile pretty fast unless you're using a lot of (1) templates, 
(2) CTFE.  Also, I find that dub builds are excruciatingly slow 
compared to just invoking dmd directly, due to network access 
and rescanning dependencies on every invocation.  I have a 
4700+ line vibe.d project; Diet templates are 
template/CTFE-heavy and generally take the longest to build. (I 
dumped dub and went back to an SCons-based system with separate 
compilation for major subsystems -- as long as I don't 
recompile Diet templates, the whole thing can build within 
seconds; with Diet templates it takes about 30 seconds :-/.)



T


Well I'm using vibe.d, but not templates on this project, just a 
minimal rest service, and a few timers and runTasks. So yeah I 
don't see why it should slow down that much.


Is there some tutorial or example for using SCons with dub 
dependencies?


Re: Bye bye, fast compilation times

2018-02-06 Thread Andres Clari via Digitalmars-d
On Tuesday, 6 February 2018 at 22:51:51 UTC, Steven Schveighoffer 
wrote:

On 2/6/18 5:23 PM, Walter Bright wrote:

On 2/6/2018 2:03 PM, Jacob Carlborg wrote:

On 2018-02-06 21:11, Walter Bright wrote:

std.string.isEmail() in D1 was a simple function. Maybe 
regex is just the wrong solution for this problem.


If I recall correctly, the current implementation of 
std.net.isEmail was requested by you.


Regardless of whether it was requested by me or not, if the 
current version is not working for us, we need to explore 
alternatives.


The regex problem is being solved:

https://github.com/dlang/phobos/pull/6129

-Steve


That's fixing just the "isEmail" issue which is good I guess.

But after reading this thread, I run some tests on one of my code 
bases, which uses about 6 regex throughout.


Switching from ctRegex! to regex yielded a 50% build time 
reduction, and from what I read even the normal regex are slowing 
things down considerably.


Might need a warning on the docs for ctRegex! explaining it'll 
screw your build times if you use it, unless there's some way to 
speed that up to something normal.


Btw, my project which is 3517 lines of D builds in 20s disabling 
the ctRegex on an i7 4770k at 4.3Ghz.


So I'd say once you start doing some more complex usages, D's 
build speed goes out the door.


Re: DLangUI Drag and Drop support?

2018-02-06 Thread Andres Clari via Digitalmars-d-learn

On Tuesday, 6 February 2018 at 08:48:47 UTC, aberba wrote:
On Saturday, 3 February 2018 at 18:06:30 UTC, Andres Clari 
wrote:

Hi, is there support for drag and drop in dlangui??
I haven't found anything on the docs, issues or forums.

I'm building a project that requires support for dropping URLs 
from the browser into a ListWidget. Is this possible with 
dlangui at all?


Can you please file an issue in the github repo. Its very 
active so it's possible support will be implemented sooner.


I created an issue for it with a basic outline of a possible 
implementation:


https://github.com/buggins/dlangui/issues/553



Re: DLangUI Drag and Drop support?

2018-02-06 Thread Andres Clari via Digitalmars-d-learn

On Monday, 5 February 2018 at 12:17:22 UTC, Jacob Carlborg wrote:

On 2018-02-03 19:06, Andres Clari wrote:

Hi, is there support for drag and drop in dlangui??
I haven't found anything on the docs, issues or forums.

I'm building a project that requires support for dropping URLs 
from the browser into a ListWidget. Is this possible with 
dlangui at all?


DWT [1] supports drag-and-drop.

[1] https://github.com/d-widget-toolkit/dwt


But DWT doesn't support macOS right? That would be my main 
target...




DLangUI Drag and Drop support?

2018-02-03 Thread Andres Clari via Digitalmars-d-learn

Hi, is there support for drag and drop in dlangui??
I haven't found anything on the docs, issues or forums.

I'm building a project that requires support for dropping URLs 
from the browser into a ListWidget. Is this possible with dlangui 
at all?


Re: Get largest heap object at runtime? ...tracking the leak

2018-01-22 Thread Andres Clari via Digitalmars-d-learn

On Monday, 22 January 2018 at 15:56:53 UTC, thedeemon wrote:

On Monday, 22 January 2018 at 06:48:00 UTC, Andres Clari wrote:
Not sure why "spawn" would leak like that tho. I would assume 
that once the thread exits, it would get destroyed and it's 
resources reclaimed, specially when I have calls to 
"GC.collect and GC.minimize".


All threads withing a process share the same heap, so whatever 
one thread allocated in that heap is not freed or reclaimed 
automatically when thread dies, it stays in the heap.


Well the destructor of some Json objects and strings should be 
called when the thread exits tho. Why wouldn’t the GC take care 
of this?


Re: Get largest heap object at runtime? ...tracking the leak

2018-01-21 Thread Andres Clari via Digitalmars-d-learn
On Monday, 22 January 2018 at 06:15:24 UTC, Dmitry Olshansky 
wrote:

On Sunday, 21 January 2018 at 17:28:13 UTC, Andres Clari wrote:
Hi, is there any way to get from the GC all allocated objects, 
so I can see their size and find where I'm leaking memory? Or 
perhaps a good tool to help with this issue...


I tried building my program with "profile-gc" but I got an 
invalid MemoryOperationError with no stack trace... so no luck 
using that. And the leak is only obvious when running in 
production, where after 6 hours I've seen 1.5Gb of memory 
usage.



Are you by chance using vibe.d?
In versions 0.8.x I observe a huge memory leak. Might be your 
problem.




Right now, I'm able to extend the life of my program by 
injecting calls to:

GC.collect
GCminimize

Within an event that happens every 5 seconds, which I estimate 
will give me about a week before the program's memory is again 
at +1.5Gb.


Yeah.

Although after doing some manual tracking and isolation of the 
suspect routines, I found that using "std.concurrency.spawn" to 
run a http post request with the "requests" library was the 
leaking suspect.


I'm triggering some 15 requests every 5 seconds in production, so 
it's obvious there, but querying "GC.usedSize" I was able to 
observe the same on my dev environment.


After removing the "spawn" call, and wrapping up the post code 
inside a "runTask", it seems to work properly now, and so far I 
have a consistently small memory size in production.


Not sure why "spawn" would leak like that tho. I would assume 
that once the thread exits, it would get destroyed and it's 
resources reclaimed, specially when I have calls to "GC.collect 
and GC.minimize".


Get largest heap object at runtime? ...tracking the leak

2018-01-21 Thread Andres Clari via Digitalmars-d-learn
Hi, is there any way to get from the GC all allocated objects, so 
I can see their size and find where I'm leaking memory? Or 
perhaps a good tool to help with this issue...


I tried building my program with "profile-gc" but I got an 
invalid MemoryOperationError with no stack trace... so no luck 
using that. And the leak is only obvious when running in 
production, where after 6 hours I've seen 1.5Gb of memory usage.


Right now, I'm able to extend the life of my program by injecting 
calls to:

GC.collect
GCminimize

Within an event that happens every 5 seconds, which I estimate 
will give me about a week before the program's memory is again at 
+1.5Gb.


Re: Vibe-d issue with timer in separate thread on debug builds

2018-01-18 Thread Andres Clari via Digitalmars-d-learn

On Thursday, 18 January 2018 at 10:03:57 UTC, drug wrote:

18.01.2018 08:45, Andres Clari пишет:


I see, then although it works (or it may work) on release 
shouldn't that assert happen for release builds by default 
too? Or is the thought that you got the error running the 
debug build you should do it a different way on your own and 
skip the check all together?


asserts are disabled in release mode, so you have no it. Better 
would be say it seems to be working in release mode.


Ahh, that explains it. Indeed.
Well I won't complain for now as it seems to be allowing me to do 
what I meant to do.


:)


Re: Vibe-d issue with timer in separate thread on debug builds

2018-01-17 Thread Andres Clari via Digitalmars-d-learn

On Tuesday, 16 January 2018 at 09:04:18 UTC, Sönke Ludwig wrote:

Am 10.01.2018 um 15:40 schrieb Andres Clari:
Hi, I have an app that uses vibe tasks, fibers and timers 
extensively, and I found an issue only for debug builds, when 
canceling a timer. However the code in question works just 
fine in the release build.


But having this here makes testing certain things in my 
program a pain, since it'll crash on the assert in question:


vibe-d-0.8.2/vibe-d/core/vibe/core/drivers/libevent2.d:474
debug assert(m_ownerThread is () @trusted { return 
Thread.getThis(); } ());



Also, not sure I understand that assert properly... Is it 
checking the stop timer call is fired from the main thread the 
event loop is running? That would be bad, since basically that 
timer run from a child thread.


The basic requirement for almost all vibe.d primitives is that 
they may only be used within the same thread in which they were 
created. Anything else requires message passing (e.g. using 
std.concurrency) to issue the operation in the owner thread.


There incidentally is a recent thread on the vibe.d forum on 
this topic: 
https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/48663/


I see, then although it works (or it may work) on release 
shouldn't that assert happen for release builds by default too? 
Or is the thought that you got the error running the debug build 
you should do it a different way on your own and skip the check 
all together?


Vibe-d issue with timer in separate thread on debug builds

2018-01-10 Thread Andres Clari via Digitalmars-d-learn
Hi, I have an app that uses vibe tasks, fibers and timers 
extensively, and I found an issue only for debug builds, when 
canceling a timer. However the code in question works just fine 
in the release build.


But having this here makes testing certain things in my program a 
pain, since it'll crash on the assert in question:


vibe-d-0.8.2/vibe-d/core/vibe/core/drivers/libevent2.d:474
debug assert(m_ownerThread is () @trusted { return 
Thread.getThis(); } ());



Also, not sure I understand that assert properly... Is it 
checking the stop timer call is fired from the main thread the 
event loop is running? That would be bad, since basically that 
timer run from a child thread.


Re: C++ Interop

2018-01-06 Thread Andres Clari via Digitalmars-d-learn

On Saturday, 6 January 2018 at 13:51:54 UTC, qznc wrote:
It would be great to have std::vector and std::string out of 
the box in D, but putting it into druntime? Druntime is 
supposed to be shared among all frontends, isn't it? GCC and 
Clang probably do not have equivalent vector/string classes 
that the same D code can be used.


+1 Supporting std::vector and std::string would be a major help


Re: Who here uses vibe-s3 from code.dlang.org?

2017-08-11 Thread Andres Clari via Digitalmars-d

On Friday, 11 August 2017 at 13:11:36 UTC, aberba wrote:


After comparing Google's object storage platform with Amazon, I 
found Google's to be much simpler and straight forward plus it 
uses a json  based api which is much simple to parse and 
understand.


Maybe, but some people have to or prefer to use Amazon services, 
ideally we'd have libraries for both ecosystems. No ones software 
is an island, we have to talk other programs and services.


Re: Who here uses vibe-s3 from code.dlang.org?

2017-08-10 Thread Andres Clari via Digitalmars-d

On Monday, 7 August 2017 at 22:46:57 UTC, aberba wrote:
vibe-s3 (https://code.dlang.org/packages/vibe-s3) is an Amazon 
s3 object storage API for D.


Has anyone here used or tested it? What was your experiences? 
It has the tagline "this library is highly alpha and mostly 
untested. use at your own risk".


Last time I tested it around Nov, 2016, it was very buggy. I'm 
using an in-house deimos wrapper for "libs3".


I would be awesome to have some native library for S3, and other 
AWS stuff, but I'm very thrown back by having it depend on 
vibe.d. Nothing against it, but say you just want to make a 
simple upload utility specialized, having to depend on vibe.d for 
that really is something unacceptable.


Ideally we'd wanna have a library for the whole Amazon auth stuff 
wrapped, and libraries for the specific services you want to use, 
being as standalone as possible.




GtkD custom theme on Windows

2017-08-03 Thread Andres Clari via Digitalmars-d-learn
I've made a linux program with GtkD, and so far, it's been pretty 
awesome, however I'm thinking about porting it to Windows also, 
but the Adwaita theme is too fugly, and cringy, so I'd want to 
use a compatible theme, which is supposed to be doable.


What would be the way to go to make a GtkD app use a custom GTK 
theme in Windows?
I tried this in the past, but never succeeded following 
documentation found online.