Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 18, 2024 at 04:23:16PM +, Renato via Digitalmars-d-learn wrote: [...] > Ok, last time I'm running this for someone else :D > > ``` > Proc,Run,Memory(bytes),Time(ms) > ===> ./rust > ./rust,23920640,30 > ./rust,24018944,147 > ./rust,24068096,592 > ./rust,24150016,1187 > ./rust,776601

Re: vector crash

2024-01-18 Thread zjh via Digitalmars-d-learn
On Friday, 19 January 2024 at 02:13:08 UTC, zjh wrote: ... `Compile command`: ```d dmd -i cy2.d dparse.lib ``` need libdparse lib.

Re: vector crash

2024-01-18 Thread zjh via Digitalmars-d-learn
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote: ```d import std.stdio, std.range,std.file; import std.string:strip; import dparse.ast; import dparse.lexer; import dparse.parser : parseModule; import dparse.rollback_allocator : RollbackAllocator; import core.stdcpp.vector; import core.s

Re: Datetime format?

2024-01-18 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 18, 2024 at 11:58:32PM +, zoujiaqing via Digitalmars-d-learn wrote: > On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis wrote: > > On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via > > Digitalmars-d- learn wrote: > > > ```D > > > import std.datetime : Clock,

Re: Datetime format?

2024-01-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, January 18, 2024 4:58:32 PM MST zoujiaqing via Digitalmars-d- learn wrote: > On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis > > wrote: > > On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via > > > > Digitalmars-d- learn wrote: > >> ```D > >> import std.datetime

Re: Datetime format?

2024-01-18 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 18 January 2024 at 23:26:42 UTC, zoujiaqing wrote: ```D import std.datetime : Clock, format; import std.stdio : writeln; void main() { auto currentTime = Clock.currTime; auto formattedTime = currentTime.format("%Y-%m-%d %H:%M:%S"); writeln("Formatted Time: ", formatt

Re: Datetime format?

2024-01-18 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis wrote: On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via Digitalmars-d- learn wrote: ```D import std.datetime : Clock, format; import std.stdio : writeln; void main() { auto currentTime = Clock.currTime; auto fo

Re: Datetime format?

2024-01-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via Digitalmars-d- learn wrote: > ```D > import std.datetime : Clock, format; > import std.stdio : writeln; > > void main() > { > auto currentTime = Clock.currTime; > > auto formattedTime = currentTime.format("%Y-%m-%d %H:%M:%S"); >

Datetime format?

2024-01-18 Thread zoujiaqing via Digitalmars-d-learn
```D import std.datetime : Clock, format; import std.stdio : writeln; void main() { auto currentTime = Clock.currTime; auto formattedTime = currentTime.format("%Y-%m-%d %H:%M:%S"); writeln("Formatted Time: ", formattedTime); } ```

Re: vector crash

2024-01-18 Thread Renato via Digitalmars-d-learn
On Thursday, 18 January 2024 at 04:31:52 UTC, zjh wrote: On Thursday, 18 January 2024 at 04:24:18 UTC, zjh wrote: ```d class V : ASTVisitor { Vector!string f=[]; alias visit = ASTVisitor.visit; override void visit(const FunctionDeclaration decl) { writeln(' '.repeat(inden

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-18 Thread Renato via Digitalmars-d-learn
On Wednesday, 17 January 2024 at 16:54:00 UTC, H. S. Teoh wrote: On Wed, Jan 17, 2024 at 07:57:02AM -0800, H. S. Teoh via Digitalmars-d-learn wrote: [...] I'll push the code to github. [...] Here: https://github.com/quickfur/prechelt/blob/master/encode_phone.d T BTW here's you main funct

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-18 Thread Renato via Digitalmars-d-learn
On Wednesday, 17 January 2024 at 16:54:00 UTC, H. S. Teoh wrote: On Wed, Jan 17, 2024 at 07:57:02AM -0800, H. S. Teoh via Digitalmars-d-learn wrote: [...] I'll push the code to github. [...] Here: https://github.com/quickfur/prechelt/blob/master/encode_phone.d T Ok, last time I'm running

Re: length's type.

2024-01-18 Thread zjh via Digitalmars-d-learn
On Thursday, 18 January 2024 at 07:44:00 UTC, Jonathan M Davis wrote: ```d auto a = foo(); or auto len = arr.length; Thank you for your reply, just to use `auto`.