Thread View: borland.public.delphi.basm
12 messages
12 total messages
Started by Atle Smelv�r
Thu, 22 Aug 2002 22:42
Is nobody here feeling for an optimize challenge?
Author: Atle Smelv�r
Date: Thu, 22 Aug 2002 22:42
Date: Thu, 22 Aug 2002 22:42
3 lines
1020 bytes
1020 bytes
Refering to my post: "Help for optimization" :) -Atle
Re: Is nobody here feeling for an optimize challenge?
Author: Robert Lee
Date: Thu, 22 Aug 2002 23:24
Date: Thu, 22 Aug 2002 23:24
14 lines
1398 bytes
1398 bytes
"Atle Smelv�r" wrote: > Refering to my post: "Help for optimization" :) The thing it that you haven't really given us a proper problem yet. Your code is fairly decent given the algorithm. What we really would like to do is check the algorithm and we need a compiling program with, if not actual sample data, at least an idea of what sample data would be like. -- Bob Lee High Performance Delphi - http://www.optimalcode.com/
Re: Is nobody here feeling for an optimize challenge?
Author: Atle Smelv�r
Date: Fri, 23 Aug 2002 06:58
Date: Fri, 23 Aug 2002 06:58
99 lines
3839 bytes
3839 bytes
Ok, here are the consts and types involved:
const
AntallDagkoder = 365
type
TTurNode = record // 16 bytes
NodeID : integer;
idTid : integer;
maxTid : integer;
Tider : TTidNoder;
Turer : TKeyValArr;
end;
TTurNoder = array of TTurNode;
TTidNoder = array of TTidNode;
TTidNode = record // 8 bytes
StartTid : word; // Start on trip in format, minutes from
midnight, max 1439
Tid : word; // Time used on the trip
ShortHeap : integer; // Index pointer to a record in THeapNoder
end;
THeapNode = record // size 64 bytes, left out the ones not used here
Finished : boolean;
FraDeltadag : shortint;
DkoBufferPtr : pDkoBuffer; // Pointer to DayCodeBuffer
end;
THeapNoder = array of THeapNode;
TDkoBuffer = array[0..AntallDagkoder-1] of boolean;
pDkoBuffer = ^TDkoBuffer;
//NodeTider points to a record in TTurNoder, id points to a record in
TTurNode's TTidNoder,
// day holds active day, return value is the first valid time backwards that
runs at active day
// in most lucky cases this would be the same as id, else it travels back at
max 7 days (visibledager)
function TReiseMotor.ValidBackTime(NodeTider: TTurNode; id: integer; var
dag: integer): integer;
var
i,
nydag,
maxdag : integer;
begin
result := -1;
maxdag := dag - VisibleDager;
nydag := dag;
if maxdag < 0 then maxdag := 0;
i := id;
while (nydag >= maxdag) do with fHeapPtr^[NodeTider.Tider[i].ShortHeap] do
begin
if not Finished and DkoBufferPtr^[nydag+FraDeltadag] then
begin
result := i;
break;
end;
dec(i);
if i < 0 then begin i := NodeTider.idTid; dec(nydag); end;
end;
if result >= 0 then dag := nydag;
end;
// This little proc is executed several million times from withing other
procs in the main algorithm.
// Assembly version is in my prev. post..
To test it,. copy these types etc. and push some values inside,. then
execute the proc. within a for loop,.
for i := 0 to 2000000 do ValidBackTime(....);
Hope this is enough for a testbed. Thanx for any suggestions and tips.
-Atle
"Robert Lee" <rhlee@optimalcode.com> wrote in message
news:3D6572A1.8192E172@optimalcode.com...
> "Atle Smelv�r" wrote:
>
> > Refering to my post: "Help for optimization" :)
>
> The thing it that you haven't really given us a proper problem yet.
> Your code is fairly decent given the algorithm. What we really would
> like to do is check the algorithm and we need a compiling program with,
> if not actual sample data, at least an idea of what sample data would be
> like.
>
>
> --
> Bob Lee
> High Performance Delphi - http://www.optimalcode.com/
>
>
Re: Is nobody here feeling for an optimize challenge?
Author: Hallvard Vassbotn
Date: Fri, 23 Aug 2002 07:48
Date: Fri, 23 Aug 2002 07:48
13 lines
1416 bytes
1416 bytes
"Atle Smelv�r" wrote: > Ok, here are the consts and types involved: Your code still doesn't compile. > To test it,. copy these types etc. and push some values inside I'm afraid you have to write that code too. > Hope this is enough for a testbed. It is not, IMO. You expect people to do too much work just trying to replicate your test-bench.
Re: Is nobody here feeling for an optimize challenge?
Author: Christen Fihl
Date: Fri, 23 Aug 2002 10:46
Date: Fri, 23 Aug 2002 10:46
23 lines
1790 bytes
1790 bytes
I did not read the problem, but I noticed the scandinavian language like in "FraDeltaDag". Being a dane, I can read the variables, but I guess you would get more listeners if you used english variablenames like "FromDeltaDay". Browsing the code, I would say that the best initial optimization has to be done in pascal only. Maybe fix the function from ValidBackTime(NodeTider: TTurNode; id: integer; var dag: integer): integer; to ValidBackTime(VAR NodeTider: TTurNode; id: integer; var dag: integer): integer; or ValidBackTime(CONST NodeTider: TTurNode; id: integer; var dag: integer): integer; as I guess you are using much time just copying data around. -- Christen Fihl http://HSPascal.Fihl.net/
Re: Is nobody here feeling for an optimize challenge?
Author: Atle Smelv�r
Date: Fri, 23 Aug 2002 13:01
Date: Fri, 23 Aug 2002 13:01
3 lines
1188 bytes
1188 bytes
Thanx for the tips. By fixing the parameter I got some more speed. -Atle
Re: Is nobody here feeling for an optimize challenge?
Author: Rudy Velthuis (TeamB)
Date: Fri, 23 Aug 2002 20:01
Date: Fri, 23 Aug 2002 20:01
15 lines
1760 bytes
1760 bytes
In article <3d661237$1@newsgroups.borland.com>, Christen Fihl says... > I did not read the problem, but I noticed the scandinavian language like > in "FraDeltaDag". > Being a dane, I can read the variables, but I guess you would get more > listeners if you used english variablenames like "FromDeltaDay". Oh, yes, indeed. I have never gotten used to localised variable names, not even in Dutch or German. I always think and write in English, when programming, although it is not my first or second language. -- Rudy Velthuis (TeamB) "If we knew what it was we were doing, it would not be called research, would it?" -- Albert Einstein
Re: Is nobody here feeling for an optimize challenge?
Author: Guido Gybels
Date: Tue, 27 Aug 2002 07:47
Date: Tue, 27 Aug 2002 07:47
9 lines
1446 bytes
1446 bytes
"Rudy Velthuis (TeamB)" <rvelthuis@gmx.de> wrote in message news:MPG.17d0b2f77326567898df99@207.105.83.65... > Oh, yes, indeed. I have never gotten used to localised variable names, > not even in Dutch or German. I always think and write in English, when > programming, although it is not my first or second language. Same here. Guido
Re: Is nobody here feeling for an optimize challenge?
Author: Tomaz Koritnik
Date: Thu, 29 Aug 2002 21:15
Date: Thu, 29 Aug 2002 21:15
14 lines
1264 bytes
1264 bytes
Hi
I volunteer but it's gonna cost you. It's cheap, I only charge 9 cents
per microsecond.
Tomaz
"Atle Smelv�r" <atle.smelvaer@broadpark.no> wrote in message
news:3d65671c$1@newsgroups.borland.com...
> Refering to my post: "Help for optimization" :)
>
> -Atle
>
>
Re: Is nobody here feeling for an optimize challenge?
Author: Guido Gybels
Date: Fri, 30 Aug 2002 07:58
Date: Fri, 30 Aug 2002 07:58
15 lines
1512 bytes
1512 bytes
"Tomaz Koritnik" <tomaz.koritnik1@guest.arnes.si> wrote in message news:3d6e8ee9@newsgroups.borland.com... > I volunteer but it's gonna cost you. It's cheap, I only charge 9 cents > per microsecond. LOL! Guido -- Guido Gybels http://www.optimalcode.com/Guido (Disclaimer: all remarks made apply to Intel processors unless specified otherwise)
Re: Is nobody here feeling for an optimize challenge?
Author: Guido Gybels
Date: Mon, 02 Sep 2002 08:10
Date: Mon, 02 Sep 2002 08:10
14 lines
1413 bytes
1413 bytes
"Atle Smelv�r" <atle.smelvaer@broadpark.no> wrote in message news:3d70c7ab@newsgroups.borland.com... > and it sure doesn't look like anyone here has the abillity to help me.. You are wrong there. Guido -- Guido Gybels http://www.optimalcode.com/Guido (Disclaimer: all remarks made apply to Intel processors unless specified otherwise)
Re: Is nobody here feeling for an optimize challenge?
Author: Hallvard Vassbotn
Date: Mon, 02 Sep 2002 09:48
Date: Mon, 02 Sep 2002 09:48
5 lines
1226 bytes
1226 bytes
"Atle Smelv�r" wrote: > it sure doesn't look like anyone here has the abillity to help me.. You haven't bothered to post a full compiling reference implementation with test data yet, have you?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads