Live data from Hacker News

I've implemented a new HTTP/1.1 request and response parser by hand

four.livejournal.com

11–20 of 44 posts

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#11

At my company we rolled our own too. The hard part was tracking down all the brain-dead servers that seemingly worked fine with browsers, but were off spec.

Are there any good sets of HTTP compatibility tests which test deviations from the spec which show up in existing servers/browsers?

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#12
post #4

Earlier quoted context omitted.

"I can make it arbitrarily fast if I don't actually have to make it work": http://blogs.msdn.com/larryosterman/archive/2009/09/29/i-can...

I'm disappointed that the student who hardcoded the results was disqualified. You should get points for finding bugs in your professors' specification.

Not to mention the "winning" entry did exactly the same thing: found an `n' # of words which works for this input only, then created a fast algorithm that works for this input only, but is incorrect in general.

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#13
post #7
post #4

Earlier quoted context omitted.

"I can make it arbitrarily fast if I don't actually have to make it work": http://blogs.msdn.com/larryosterman/archive/2009/09/29/i-can...

After reading that, I wonder if trie-s (i.e. judy arrays) would beat hash tables in this exercise... (and I also think that hardcoding the results wasn't cheating)

Since when are judy arrays synonymous with tries?

Judy arrays were only invented and publicized in 2004 and the only public implementation is GPLed.

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#15
post #7
post #4

Earlier quoted context omitted.

"I can make it arbitrarily fast if I don't actually have to make it work": http://blogs.msdn.com/larryosterman/archive/2009/09/29/i-can...

After reading that, I wonder if trie-s (i.e. judy arrays) would beat hash tables in this exercise... (and I also think that hardcoding the results wasn't cheating)

With some pointer arithmetic, I would imagine so (with tries, not sure what judy arrays are)... although it might depend into how quickly memory can be allocated/accessed. Assuming the text is a set of lower-case alphabet character strings, you could define a 26-ary trie with very few instructions to do each characters' lookup...

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#16
post #13
post #7

Earlier quoted context omitted.

After reading that, I wonder if trie-s (i.e. judy arrays) would beat hash tables in this exercise... (and I also think that hardcoding the results wasn't cheating)

Since when are judy arrays synonymous with tries? Judy arrays were only invented and publicized in 2004 and the only public implementation is GPLed.

[deleted]

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#17
post #15
post #7

Earlier quoted context omitted.

After reading that, I wonder if trie-s (i.e. judy arrays) would beat hash tables in this exercise... (and I also think that hardcoding the results wasn't cheating)

With some pointer arithmetic, I would imagine so (with tries, not sure what judy arrays are)... although it might depend into how quickly memory can be allocated/accessed. Assuming the text is a set of lower-case alphabet character strings, you could define a 26-ary trie with very few instructions to do each characters' lookup...

I would be willing to bet that that implementation is slower than a hash table.

(Yeah, I do have some data to back that up - I wrote & benchmarked an autocomplete implementation for a financial software firm. String tries were roughly 10x slower than binary searching an array for a 20k word corpus, which is probably around the size you're dealing with here. They have terrible cache locality - each character makes you follow a pointer, which is probably a cache miss, and the total size of the trie is on the order of 26 * 8 * 20k = 4M. They become a bit better if the number of distinct words in the corpus is small (so that everything fits into cache) or if the number of words is huge (so that your hashtable or array blows the cache anyway).

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#18
post #16
post #13

Earlier quoted context omitted.

Since when are judy arrays synonymous with tries? Judy arrays were only invented and publicized in 2004 and the only public implementation is GPLed.

[deleted]

For the record, and I am sure it's what you meant, a more specific description of Judy arrays is that they are a specific type of trie(though a trie is a specialization of a tree a trie is more rigorous.)

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#19
post #16
post #13

Earlier quoted context omitted.

Since when are judy arrays synonymous with tries? Judy arrays were only invented and publicized in 2004 and the only public implementation is GPLed.

[deleted]

This of i.e. as 'that is' and e.g. as "example given'.

Re: I've implemented a new HTTP/1.1 request and response parser by hand

#20
post #16

Earlier quoted context omitted.

[deleted]

For the record, and I am sure it's what you meant, a more specific description of Judy arrays is that they are a specific type of trie(though a trie is a specialization of a tree a trie is more rigorous.)

Judy Arrays are all Tries are all Trees, but only some Trees are Tries, and only some Tries are Judy Arrays.
Post reply on HN