03-Mar-2013 03:12, Namespace пишет:
I noted it to late: decode comes from readText: readText validates your
text. I will now use std.file.read.
That's why Walter promotes profilers. They help verify hypothesis on
performance and constantly surprise people in what they actually find.
The n
03-Mar-2013 03:52, Namespace пишет:
I think that thanks to your suggestions isKeyword and isType are
entirely inlined, because they aren't listet in the trace.log anymore
(http://dpaste.1azy.net/b94b19ff). The only thing which makes trouble is
the isNext function.
Maybe I should also use a String
I noted it to late: decode comes from readText: readText
validates your text. I will now use std.file.read.
The new trace output is here and it seems you're right, isKeyword
and isType (yes I'd decided to separate it again and keep both in
the lexer) take a lot of time:
http://dpaste.1azy.ne
On 03/02/2013 11:56 PM, Samuel Lampa wrote:
On 03/02/2013 11:52 PM, Samuel Lampa wrote:
* DMD64 D Compiler v2.061(using flags "-gc")
Ah, never mind!
By giving these details I got myself thinking and read up on the man
page to use "-g" and not "-gc".
Problem solved! :)
Very happily debuggin
I never used the -profile flag before (only -conv) so I want to
ask if I understand it right:
http://dpaste.1azy.net/4382097b
It seems that the call which is listed on line 133
1589328 214949 214948 0 pure @trusted
dchar std.utf.decode!(const(immutable(char)[])).decode(r
On 03/02/2013 11:52 PM, Samuel Lampa wrote:
* DMD64 D Compiler v2.061(using flags "-gc")
Ah, never mind!
By giving these details I got myself thinking and read up on the man
page to use "-g" and not "-gc".
Problem solved! :)
Very happily debugging D with cgdb now! :)
// Samuel
On 03/02/2013 11:33 PM, Samuel Lampa wrote:
When using gdb to debug my d program, is there any way to correctly
display the string variables? (I'm new to gdb, so I might have missed
something?).
Oh, and I have:
* GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
* Compiled with:
*
Hi,
When using gdb to debug my d program, is there any way to correctly
display the string variables? (I'm new to gdb, so I might have missed
something?).
if I do:
print(myString), I will only get something like:
$1 = 0x7fffe8970018
Best Regards
// Samuel
02-Mar-2013 23:50, Zach the Mystic пишет:
On Saturday, 2 March 2013 at 11:59:39 UTC, Dmitry Olshansky wrote:
02-Mar-2013 15:04, David пишет:
Am 02.03.2013 10:33, schrieb Namespace:
For one of our courses this year we have a very cool topic: Lexer and
Compiler.
In the past I have already tried
03-Mar-2013 00:03, Namespace пишет:
This is a mess of conditionals is what a direct array of 256 entries
would avoid:
int idx;
if (value[0] != '_') {
idx = value[0] - 'a';
if (idx == 26) return false;
} else {
idx = 26;
}
if (idx < 0 || idx > 26) {
It is sufficient if my array has only 26 units, because I check
only lower cases.
On Sat, 02 Mar 2013 11:02:08 +0100, simendsjo wrote:
invariant is called when a method enters. This creates problems if the
constructor calls a setter:
import std.exception;
struct S {
private int _i;
public:
this(int i) {
this.i = i;
}
@property void i(int v) {
enfo
This is a mess of conditionals is what a direct array of 256
entries would avoid:
int idx;
if (value[0] != '_') {
idx = value[0] - 'a';
if (idx == 26) return false;
} else {
idx = 26;
}
if (idx < 0 |
On Saturday, 2 March 2013 at 11:59:39 UTC, Dmitry Olshansky wrote:
02-Mar-2013 15:04, David пишет:
Am 02.03.2013 10:33, schrieb Namespace:
For one of our courses this year we have a very cool topic:
Lexer and
Compiler.
In the past I have already tried some experiments in this
direction with
02-Mar-2013 23:01, Namespace пишет:
I hope I understand you right this time:
http://dpaste.1azy.net/4c2e4428
Was this your idea?
With this I reached between 215 and 230 msecs.
This is a mess of conditionals is what a direct array of 256 entries
would avoid:
int idx;
if (valu
On 3/2/13, simendsjo wrote:
> Which can you recommend?
I use ae's lite xml library:
https://github.com/CyberShadow/ae/blob/master/utils/xmllite.d
It's not a monster but thanks to UFCS I can easily extend it to do
what I want. For some trivial xml parsing which I needed it was great
(OTOH std.xm
02-Mar-2013 22:15, Dmitry Olshansky пишет:
02-Mar-2013 22:09, Namespace пишет:
No-no and no.
Just translate list of keywords/types to a bunch of switch-cases that
will give you near optimal performance. Use CTFE to construct that
string of D code.
In fact I proposed to do just 2 levels of switc
02-Mar-2013 22:09, Namespace пишет:
No-no and no.
Just translate list of keywords/types to a bunch of switch-cases that
will give you near optimal performance. Use CTFE to construct that
string of D code.
In fact I proposed to do just 2 levels of switches: first switch by
length then by first ch
No-no and no.
Just translate list of keywords/types to a bunch of
switch-cases that will give you near optimal performance. Use
CTFE to construct that string of D code.
In fact I proposed to do just 2 levels of switches: first
switch by length then by first char.
I don't understand.
You don'
Thanks a lot for your reply.
Hello all,
Can anyone advise on the theoretical basis for the unpredictableSeed method in
std.random? I've tried googling around for the theory of good thread-safe seed
generation methods but haven't really found anything. :-(
Thanks & best wishes,
-- Joe
On Saturday, 2 March 2013 at 08:03:08 UTC, simendsjo wrote:
Everyone says "Don't use std.xml", and there are several other
libraries.
Which can you recommend? (I haven't looked closely at any of
them, just some links found by googling)
https://github.com/adamdruppe/misc-stuff-including-D-progr
02-Mar-2013 18:53, Namespace пишет:
That would be slower as canFind is linear search.
Simpler way is use first letter and length to select a bucket of
keywords.
I think I get it.
Did you mean something like this?
No-no and no.
Just translate list of keywords/types to a bunch of switch-cases
I don't do XML working with D, but with Python. Actually I'd prefer
never to have to work with XML at all but,…
After many different Python oriented (either Python implemented or C
coded Python extensions), the tide has now turned to simply using
libxml2 and libxslt using an adaptor library, lxml.
On 2013-03-02 09:03, simendsjo wrote:
Everyone says "Don't use std.xml", and there are several other libraries.
Which can you recommend? (I haven't looked closely at any of them, just
some links found by googling)
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuf
I use the dom.d in the long misc github link. (I wrote it for
myself)
I find it very convenient but there are some downsides:
1) it is slow with large files
2) it eats a lot of memory, I think about 150 bytes per node,
plus the actual data (text and attributes). A 1 MB xml file can
easily eat
That would be slower as canFind is linear search.
Simpler way is use first letter and length to select a bucket
of keywords.
I think I get it.
Did you mean something like this?
[code]
immutable ubyte[char] typeMap;
immutable ubyte[char] keywordMap;
static this() {
typeMap = [
'd' :
I sorted both, types and keywords, alphabetical and wrote my own
'canFind':
bool canFind(const size_t size)(ref const string[size] values,
string value) pure nothrow {
if (value[0] < 'm' || value[0] == '_') {
foreach (string _val; values) {
if (_
With canFind it takes ~300 msecs. :/
Any idea how I could improve it?
Simpler way is use first letter and length to select a bucket
of keywords.
I don't understand how you could do this without AA's and how
this could be more performant than canFind.
Make a property private?
02-Mar-2013 15:04, David пишет:
Am 02.03.2013 10:33, schrieb Namespace:
For one of our courses this year we have a very cool topic: Lexer and
Compiler.
In the past I have already tried some experiments in this direction with
Romulus and Remus, but I've never measured my Lexing time.
That's why I
Am 02.03.2013 10:33, schrieb Namespace:
> For one of our courses this year we have a very cool topic: Lexer and
> Compiler.
> In the past I have already tried some experiments in this direction with
> Romulus and Remus, but I've never measured my Lexing time.
> That's why I wanted to start again to
I'm already using these flags. But thanks for your Link I will
take a look at it. :)
02-Mar-2013 13:33, Namespace пишет:
For one of our courses this year we have a very cool topic: Lexer and
Compiler.
In the past I have already tried some experiments in this direction with
Romulus and Remus, but I've never measured my Lexing time.
That's why I wanted to start again to write a lex
On Saturday, 2 March 2013 at 08:03:08 UTC, simendsjo wrote:
Everyone says "Don't use std.xml", and there are several other
libraries.
Which can you recommend? (I haven't looked closely at any of
them, just some links found by googling)
https://github.com/adamdruppe/misc-stuff-including-D-progr
invariant is called when a method enters. This creates problems
if the constructor calls a setter:
import std.exception;
struct S {
private int _i;
public:
this(int i) {
this.i = i;
}
@property void i(int v) {
enforce(v > 1);
_i = v;
}
invariant() {
assert(_i > 1);
For one of our courses this year we have a very cool topic: Lexer
and Compiler.
In the past I have already tried some experiments in this
direction with Romulus and Remus, but I've never measured my
Lexing time.
That's why I wanted to start again to write a lexer (hitherto
purely for the learni
On Saturday, 2 March 2013 at 03:59:59 UTC, H. S. Teoh wrote:
On Sat, Mar 02, 2013 at 04:17:10AM +0100, Rob T wrote:
In my case, the problem had to do with the order in which I was
linking my static libs, simply changing the order resolved the
undefined references. Turns out it's a common problem
Everyone says "Don't use std.xml", and there are several other
libraries.
Which can you recommend? (I haven't looked closely at any of
them, just some links found by googling)
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d
http://svn.dsourc
39 matches
Mail list logo