Jump to content
Gustavo 'Gus' Carreno

Offical launch of the 1 Billion Row Challenge in Object Pascal

Recommended Posts

Posted (edited)

This is a "classical" problem with Delphi, overloaded functions, and floating points values.

 

IMHO using currency is an awful workaround here, and should not be kept in any serious codebase.
It works "by chance".

 

Another workaround, still using the Math unit, is to make the computation in two steps:

function RoundExDouble(x: double): Double;
begin
  x := x * 10;
  Result := Ceil(x) / 10;
end;

function RoundExInteger(x: double): Integer;
begin
  x := x * 10;
  Result := Ceil(x);
end;

So the expected Ceil(double) overload is clearly picked up by the compiler.

 

Or define our own unique Ceil() function, which does not depend on Math.pas and ensure we use the right value type:

function ceil(x: double): integer;
begin
  result := trunc(x) + ord(frac(x) > 0);
end;

This is this solution I used in my entry of the challenge: stay away from Math.pas. 😉

 

Edited by Arnaud Bouchez
  • Like 1
  • Thanks 1

Share this post


Link to post

Hey my challenge peeps!!

 

I've been busy:

  • The automation is now done for both Linux and Windows
  • We are back to the previous output hash: 4256d19d3e134d79cc6f160d428a1d859ce961167bd01ca528daca8705163910
  • I've altered all the entries that were using an internal version of the rounding functions to use the one from the baseline

Today is Saturday, and now that I have the automation completed, I'll run the full shebang and will update the results table once they are done.

 

Cheers,

Gus

Share this post


Link to post
On 3/29/2024 at 11:37 AM, Rollo62 said:

Nice list, thanks 👍

 

And don't forget the command line parser available in mORMot 2.

- Works on all OS;

- Works on Delphi and FPC;

- Can auto-generate the help content with proper formatting;

- Minimal code writing.

 

In practice, resulting code is short and efficient:

https://github.com/synopse/1brc-ObjectPascal/blob/main/entries/abouchez/src/brcmormot.lpr#L446

  • Like 1
  • Thanks 1

Share this post


Link to post

My dear challenge peeps!!

 

Now that the Blaise Pascal Magazine new edition is out, I can finally talk about this:

  • Ian Barker has written an article that mentions our little challenge.

I would provide a link to this new edition if I could. Their site is a bit sub-par, to put it quite politely.

 

Cheers,
Gus

  • Like 1

Share this post


Link to post

Hey my challenge peeps!!


I was given owner access to https://github.com/1brc after asking to be included on the https://1brc.dev site.
Yeah, I know, owner... Still don't understand why, but it's where we're at, LOL!! 😄
Now I'm in a bit of a pickle: I don't have an icon that will represent Object Pascal.
There's many for Delphi, and many for Lazarus, but none for Object Pascal in general.
Can anyone help me on this?

 

Cheers,

Gus

Share this post


Link to post
Posted (edited)

Hey my challenge peeps!!


I've been thinking about adding an alternative results table in order to compare to the original Java specs of only 400 stations and 8 threads.
This means that some of the assumptions for the current state of things would probably be crippling in that case.
What do you guys think of adding a -4 or --400-stations command line switch to your entries?

 

Cheers,

Gus

Edited by Gustavo 'Gus' Carreno

Share this post


Link to post

Hey my challenge peeps!!


We are moving from the input file having CRLF to having only LF as the line terminator.
Next run, the 27th of April, will be mixed to leave enough time for everyone to make the necessary changes.
The next run after that, the 4th of May, will not be mixed and will expect every entry to have made changes if necessary.
The SHA256 for said input file has already been updated on the README.md file.

 

Cheers,

Gus

Share this post


Link to post

Hey my challenge peeps!!


Georges suggested that we may give a helping hand to the entries that haven't yet done the change from CRLF to LF only.
If any of you want to have a stab at it, it would be greatly appreciated!!
And, does anyone know how to contact Lurendrejer Aksen? His entry has been kinda abandoned and I would like to see it working properly, if possible.
Many thanks to my wonderful participants in advance!!

 

Cheers,

Gus

Share this post


Link to post
Posted (edited)
26 minutes ago, Gustavo 'Gus' Carreno said:

the entries that haven't yet done the change from CRLF to LF only.

No need for any changes to my entry--TStreamReader handles both already. And yes, I tested it. :classic_biggrin:

Edited by corneliusdavid
  • Like 1

Share this post


Link to post

Hey David,

 

1 minute ago, corneliusdavid said:

No need for any changes to my entry--TStreamReader handles both already. And yes, I tested it. :classic_biggrin:

 

Awesome sauce !!
Thanks !!

Cheers,

Gus

Share this post


Link to post

Hey my challenge peeps!!


We are quickly approaching the deadline for our little challenge.
While the end date is next Friday, I will post the last results after I run the automation on Sat. of Sun.
You can still drop PRs after Friday, but they will only be merged after the automation is done on Sat. or Sun.

 

My intention with this repository is to keep accepting entries for the duration of my life time.
This is the perfect round up of Object Pascal code to demonstrate that it's not dead and can compete with any of the top languages on SO or TIOBE.

 

I'm also thinking about adding the 8 thread/400 Stations table for comparison with the Java side of things.
But I guess that Paweld has made a better attempt here.
More news on this table later.

 

Cheers,

Gus

Share this post


Link to post

Hey my challenge peeps!!


The end has past.
Things are ready for the last automation run.
I'll post the results first thing after I've had a sleep.
During that sleep, the automation will run.

 

Cheers,

Gus

Share this post


Link to post

Hey my challenge peeps!!

 

We have finally arrived at the end of the challenge!!
It's been a fun ride, to say the least.
The final results have been posted, with the usual minor ooopss, of course.

 

Like stated before, I'll be accepting entries until I'm no longer in this plane of existence.
A new results table for those entries will be made, and it will include all of the entries, old and new.

 

Eventually, I'll also publish a results table for 400 Stations and 8 threads.
Just need a bit of breathing space to get that done. But it will come.

 

Let's hope this repository, and the effort of the participants, can stand as an example of the power that still resides in Object Pascal.
Let's hope we can all shut up the nay sayers by merely pointing at it.

 

All the best for you all in your future Object Pascal endeavours!!

 

Cheers,

Gus

  • Like 3
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×