Arc Forumnew | comments | leaders | submit | kogir's commentslogin
5 points by kogir 3187 days ago | link | parent | on: Why and how is Hacker News so fast?

It's fast because it's not bloated. It returns fairly minimal (if not elegant) HTML, and loads few additional resources.

The HN front page is about 7kB - many times smaller than even minimized jQuery (83kB as of 2.1.4).

The data is small and all fits in RAM on a single server during normal operation, so there's no additional network latency hitting a DB over the network.

----- Edit: Oops - missed that this was a link.

-----


On Hacker News, the ask and show pages are implemented just like the front page, but they filter the item list based on title or whether or not there's a link.

And yes, that means they won't show items not already loaded into RAM ;)

    (defop ask ((p page))
      (pagepage ranked-stories* p
                [and (askpage-filter _) _]
                "ask" "Ask"))
The magic is in askpage-filter:

    (def askpage-filter (s)
      (and (astory s)
           (blank s!url)
           (~begins (downcase s!title) "show hn")))

-----

2 points by kogir 3340 days ago | link | parent | on: Testing link submission

Seems to have worked?

-----

4 points by kogir 3435 days ago | link | parent | on: Arc Forum Maintenance

The Hacker News codebase is in Arc, and will be for the foreseeable future. All the core domain work is done in it, and we write Arc code every day. When it makes sense for performance or practical reasons we call into Racket, but not frequently enough that we've even bothered exposing nice syntax for it (like anarki's $).

-----

5 points by akkartik 3435 days ago | link

I'm not sure if you're the best person to ask, but:

Is the arc currently running HN significantly different from the arc 3.1 c. 2009?

Any plans for a new arc release? :)

Any lessons you can share from your experiences scaling up HN? (Like the push to eliminate fnids, for example.)

-----

4 points by kogir 3436 days ago | link | parent | on: Arc Forum Maintenance

Now running on the new server. DNS may take a bit to update.

Things are running on the latest FreeBSD and Racket, but the code is way behind what I've been working on in HN, so please email me at nick@ycombinator.com if you see anything wonky.

-----

3 points by kogir 3436 days ago | link | parent | on: How does HN use firebase?

We accumulate modified items and profiles by hooking save-item and save-prof. Then every 30 seconds or so we submit an update batch to Firebase using their REST API.

The biggest pain was fixing up Racket's HTTP libraries to support HTTP pipelining correctly and writing our own streaming JSON serializer than minimizes the frequency and lifetime of allocations.

-----

1 point by tvvocold 3433 days ago | link

will arc forum update in future? just like hackernews.

-----

2 points by kogir 3928 days ago | link | parent | on: Rark - An Arc inspired Racket language.

This is my fun little side project - the aim being to get Arc running inside of Racket with a little less friction: better performance, profiling support and source locations for errors.

It can run some Arc code unmodified. You'll likely be more comfortable with rark/load (which defines everything at the top level, and is hopeless [1]).

  [1.1]: https://www.google.com/search?q=racket+the+top+level+is+hopeless
  [1.2]: https://gist.github.com/samth/3083053

-----

1 point by akkartik 3923 days ago | link

Can you point out the most disagreeable changes? :)

-----

2 points by rocketnia 3922 days ago | link

Good error reporting is pretty disagreeable to me, lol. :-p

I think Arc's main advantages over Scheme, once all the Arc-like naming conventions and macros are in place, are setforms, defcall (not in pg's Arc), and the ssyntaxes (a:b c), a.b, and a!b. Going by the examples, Rark has setforms, and its ability to unwrap data structures using function calls indicates defcall wouldn't be hard to add if it isn't there already, but I don't see anything about ssyntax. I've been meaning to download and run Rark to see if ssyntax support is actually there after all.

The abstract "Scheme" I'm talking about might have a certain advantage over Racket, but I might just be doing it wrong: Is possible to write a macro and use it in the same file? I've had to break my utilities into three files just to have multiple layers of macros. I'm interested in seeing whether Rark makes this any easier.

-----

2 points by kogir 3922 days ago | link

It's currently missing extensible setforms, but all the standard ssyntax and brackets should work. They're detected and expanded (awkwardly right now) at the reader level.

-----

3 points by kogir 3922 days ago | link

It's hard to say since Arc doesn't have a formal spec. The end goal is for everything to just work like it would in pg's Arc. I'm slowly working toward that goal.

Right now, Arc s-exp editing macros are straight-up unsupported. In addition to pattern matching, you have to explicitly break hygiene with leak and bind:

  (mac nif (test body ...)
    #:leak (nit)
    (bind (nit test)
      (if nit body ...)))
  
  > (nif 5 (displayln (+ "yep: " nit)) (displayln (+ "nope: " nit)))
  yep: 5
  
  > (nif nil (displayln (+ "yep: " nit)) (displayln (+ "nope: " nit)))
  nope: 
There's more I'm sure.

-----


For some reason I can't reply higher than this, but yeah, that was a side-project of mine that's in no way official.

If you looked at it closely, I made many changes in the spirit of getting something running that PG (and you!) would likely not agree with.

I know nothing of PG's plans for future releases, and I'd not be the one doing them.

Sorry!

-----

2 points by rocketnia 3934 days ago | link

"If you looked at it closely, I made many changes in the spirit of getting something running that PG (and you!) would likely not agree with."

I didn't see the repo while it was online, but I've always looked forward to Arc (or at least Anarki) becoming usable as a Racket language at some point, even if it were an awkward fit. Just how disagreeable are we talking, here? :)

-----

2 points by kogir 3931 days ago | link

Exceptionally. I'll put it back up with a better ReadMe once I've verified I didn't accidentally leak anything I shouldn't have.

Let's just say it was bad enough that someone emailed PG to express despair at the direction things seemed to be heading.

-----

1 point by akkartik 3931 days ago | link

Well, we'll give you more constructive criticism. Often of the form, "see here for how I did it" :p

-----

2 points by akkartik 3934 days ago | link

Thanks! Welcome to the club of unofficial forks! Who cares what anybody else agrees with! :)

(I believe the HN codebase expires reply links after 14 days, as a spam control measure.)

-----