HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
renatoathaydes
prechelt-phone-number-encoding
Java2021–2021
renatoathaydes / prechelt-phone-number-encoding

prechelt-phone-number-encoding

Comparison between Java and Common Lisp solutions to a phone-encoding problem described by Prechelt

5Distinct people
6Mentions
0Explicit recommenders
30GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Comparison between Java and Common Lisp solutions to a phone-encoding problem described by Prechelt

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week6 dated mentions

Observed mentions: 2021-08-02 16:47:39 UTC to 2021-10-14 18:24:23 UTC. Weeks start Monday, UTC.

0122021-08-02 00:00:00 UTC to 2021-08-09 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsAug 22021-08-09 00:00:00 UTC to 2021-08-16 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-08-16 00:00:00 UTC to 2021-08-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-08-23 00:00:00 UTC to 2021-08-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-08-30 00:00:00 UTC to 2021-09-06 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-09-06 00:00:00 UTC to 2021-09-13 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsSep 62021-09-13 00:00:00 UTC to 2021-09-20 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-09-20 00:00:00 UTC to 2021-09-27 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-09-27 00:00:00 UTC to 2021-10-04 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-10-04 00:00:00 UTC to 2021-10-11 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-10-11 00:00:00 UTC to 2021-10-18 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsOct 11

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Aug 22021-08-02 00:00:00 UTC2021-08-09 00:00:00 UTC202
Aug 92021-08-09 00:00:00 UTC2021-08-16 00:00:00 UTC101
Aug 162021-08-16 00:00:00 UTC2021-08-23 00:00:00 UTC000
Aug 232021-08-23 00:00:00 UTC2021-08-30 00:00:00 UTC000
Aug 302021-08-30 00:00:00 UTC2021-09-06 00:00:00 UTC000
Sep 62021-09-06 00:00:00 UTC2021-09-13 00:00:00 UTC000
Sep 132021-09-13 00:00:00 UTC2021-09-20 00:00:00 UTC000
Sep 202021-09-20 00:00:00 UTC2021-09-27 00:00:00 UTC000
Sep 272021-09-27 00:00:00 UTC2021-10-04 00:00:00 UTC101
Oct 42021-10-04 00:00:00 UTC2021-10-11 00:00:00 UTC000
Oct 112021-10-11 00:00:00 UTC2021-10-18 00:00:00 UTC202

What Hacker News says

6 sources
> it’s using Unicode-aware string stuff Rust uses UTF-8 internally for Strings, so it's very efficient to parse a file into a String, then using slices to go through it... this is probably the best you can get as parsing ASCII input as UTF-8 is very efficient (the 0-bit is always zero in ASCII, the unicode decoder only needs to check that's the case for every byte, so it's not some kind of complicated computation it's doing to decode)... If you use bytes for everything, you will make the whole code much harder to follow and it still won't run faster. Check for yourself: https://github.com/renatoathaydes/prechelt-phone-number-enco...
In Optimising Common Lisp to try and beat Java and Rust on phone encoding 2/2
There are two or three branches with different versions of the Rust code, and the author is using the fastest one. What you believe will make the Rust code faster won't, trust me. If you think I'm wrong, could you please submit a PR and link here? @Cryptonic 's suggestions are laughable. Try using arrays as HashMap keys in Rust :D nope, won't even compile let alone be fast. There was a way smarter attempt here to do something *based on* arrays: https://github.com/renatoathaydes/prechelt-phone-number-enco... The DigitBytes struct is needed because just using arrays (I guess they mean slices, as arrays are obviously wrong) is incredibly slow - it would need to consider the whole array every time instead of just the relevant bytes - far slower than `Vec`. This is indeed fast, but slower than Vec. The other suggestion: print everything at the
Read the rest
end?? Do we even know what the objective is here? It's not to finish first, but to show to the user the results as soon as possible. It's like people don't even read the problem proposition and still think it's ok to criticize... also, Rust is using buffered IO... ALSO, the benchmark only prints a single line at the end for the two last runs, essentially doing "print it all at the end".
In Optimising Common Lisp to try and beat Java and Rust on phone encoding 2/2
This is a pretty introductory CL article, mostly a commentary on Norvig's solution to the problem. Still, I learned about the #. readmacro from it. The conclusion: "[The Lisp implementation] was the fastest implementation for all input sizes except the largest one, where it performed just slightly worse than my best Java implementation." GH repo at https://github.com/renatoathaydes/prechelt-phone-number-enco.... Sounds like he was mostly measuring the performance of the SBCL bignum implementation.
In Learning Common Lisp to beat Java and Rust on a phone encoding problem
It's always sad to see someone get burnt by the internet, I wish him, and also those who criticised him, well. On a brighter note, I appreciate the noob-friendly explanations. It made it really easy to follow along. I'm also really curious about how Java achieves better stdout performance. I hope we get to apply the lessons to other environments too! I didn't read all of it, so perhaps there's a clue in @bugaevc's PR[1] mentioned in the article. [1] https://github.com/renatoathaydes/prechelt-phone-number-enco...
In How to write slow Rust code – Part 2
> … his original code was n00btastic… Sorry, but this is at-least the second blog post, in the last week, and previously — "I've discussed the Rust and Julia versions with experts in those languages (—— I know Rust well enough ——, but very little Julia) and no obvious mistakes were found." https://www.reddit.com/r/lisp/comments/osqgqe/common_lisp_st... Before that, on finding the output from his Java program was different than the output from Peter Norvig's Lisp program — "It looks like Norvig's Lisp solution must have a bug: it can't find all valid solutions!" https://github.com/renatoathaydes/prechelt-phone-number-enco...
In How to write slow Rust code
I don't recommend drawing too much of a conclusion from these tests, about anything other than printing in <your language>. Once the algorithm is somewhat optimized, the benchmark is completely dominated by printing to stdout, not the algorithm in question. Pulling from the near the conclusion here, bugaevc finds: "And the measured time reflects how long it take to actually compute the solutions (≈1.6s), not how much time it takes to output/buffer them (≈59s)." source: https://github.com/renatoathaydes/prechelt-phone-number-enco...
In How to write slow Rust code

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.