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
  • 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

  • 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

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

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

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

×