Hacker Newsnew | past | comments | ask | show | jobs | submit | dpayne's commentslogin

I still use copilot as my main completion tool. I found ChatGPT to be too slow and expensive to use for tab complete level of usage, but it works really well for larger things (e.g. refactor X to do Y, or write unit tests).

You can get your API key here https://platform.openai.com/account/api-keys.


Do these api keys still work for free users?


Thank you!


One way I've found to isolate this is to turn off turbo boost and underclock the cpu, while making sure the avx offset is set to 100%. While you would never want to run a production system like this, it does help to eliminate any issues with cpu throttling. If the avx-512 version of the program still runs slower then something else is interfering besides cpu throttling.


There are many high schools like this in the U.S. that are state funded, both in very liberal and very conservative states.


Great article on the complexities of investigating performance issues! Another very interesting surprise is when I run this locally on my macbook, clang is much faster

  mac >> go run main.go
  approximating pi with 1000000000 iterations.
  3.1415926545880506
  total time taken is: 9.706911232s

  mac >> clang++ -O3 -ffast-math -march=native main.cpp
  mac >> ./a.out
  3.1415926545864963
  total time taken is: 2.14196s


The speed of the answer doesn't matter so much when the answer is wrong. And (after checking Google) BOTH of those are wrong. :/


Recompiling without fastmath gives the same answer as the article "3.1415926545880506".

  mac >> clang++ -O3 -march=native main.cpp
  mac >> ./a.out
  3.1415926545880506
  total time taken is: 4.3861569999999999s
Twice as slow as the fastmath version but still faster than the go version.


Clearly the two results are different, so something strange is going on. But you need to define wrong, consider incrementally approximating pi in 7 steps:

  100,50,25,12,4,2,3,3.5
  > 3.5
Or even:

  100,90,80,70,60,50,40
  > 40
I'm assuming you mean wrong as in the algorithm implemented with arbitrary precision would en up with a different set of digits for the number of iterations given? Or something along those lines?


Oh, I mean they're both wrong in the 10th position even though they agree. But it is curious that they diverge after that.

It's probably more a problem of the algorithm not calculating significant figures and truncating the answer.


The algorithm is computing an alternating series, with the largest n being 5x10^7. The error in an alternating series (when the sequence is strictly decreasing in absolute value) is the absolute value of the next term. This is 4/(2*(5x10^7 + 1) + 1), which is a bit less than 4x10^-8, so we would only expect 7 digits to be correct. In fact, it is the 8th digit which goes awry (not the 10th): it should be a 5 rather than a 7.

This particular series, which comes from a series for the arctan of 1, has very slow convergence. An easily better one is Machin's formula, which converges faster than a geometric series (that is, the number of terms needed is at most linear in the number of wanted digits).


However, according to math.pi in python3.3 the second number (with higher number of iterations) is closer to pi than the lower iteration number.

So is it possible that the algorithm doesn't converge to correct digits for so "few" iterations?


One caveat of perfect hash functions, including CMPH, is that for a very large amount of keys the data structs they use internally become very large. In the case of CMPH when I tried with around 30 million keys the result was several MBs which caused it to not fit in L3 cache. For large dictionaries, hash functions like xxhash and farmhash are usually a better option than the perfect hash functions.


You can combine perfect hashing with string compression (Huffman, prefix tries) and de-duplication techniques to vastly improve memory usage for a wide variety of use cases. DiscoDB does this to good effect (http://discodb.readthedocs.org/en/latest/).


If you use a fast hash function you still have to look up a hash table, so the memory access is still there. If you use some clever probing strategy you might be able to have only 1 cache line access per lookup on average, while most perfect hashing functions, which use the MWHC scheme, do 3 random accesses.

However, these 3 random accesses are independent, so the CPU can mostly pipeline them, and the perceived latency is that of a single random access.


Thanks, I know. I used one of the CMPH algorithms for the first three default methods (from pure perl to pure C), -hanov, -hanovpp, and -urban, and those perform much better than the original CMPH. And I haven't enabled compression.

But I still haven't found the best overall method yet. Hashing all keys shouldn't be necessary. There will come more later.


I don't know much about the topic but I was under the impression a minimal 1 to 1 mapping is usually possible. ref: http://www.burtleburtle.net/bob/hash/perfect.html


Here's another one of his projects where you can write ruby script using just underscores. https://github.com/mame/_


spf13 is a great plugin bundle for vim that got me started using relative line numbering. It's great for the lazy person who doesn't want to bother setting up all the fancy vim plugins and settings.

https://github.com/spf13/spf13-vim


Lazy persons get the crap they deserve with SPF13.


Polite translation: Take the time to learn how to setup vim yourself and it will reward you 10 fold.


Haha. Yes, that's what I meant. Thanks for your help.

I see two slightly overlapping trends:

1. Alice is intrigued by all the fuss about Vim and tries her best to wrap her head around it by reading online material and "The Fucking Manual" and getting her hands dirty. Because she knows that she can't be as productive as with her previous editor in an afternoon, she learns Vim on the side. Another benefit of that method (and one she doesn't know about at the moment) is that her commitment can be very light at the beginning: when she'll finally decide that Vim is not for her she won't lost anything. If she likes it her commitment will grow with time, as well as her ROI.

2. Bob is a lot into Twitter, blogs, Reddit and HN and he noticed a serious slant of what he perceives as the elite toward Vim (and the screenshots are pretty) so he decides to follow the herd, however weird Vim might be He installs Janus/SPF13/YADR because he has to be a part of the elite right now, no time to setup all those plugins and stuff. After a couple of coderwall posts listing his favorite plugins, Bob will notice that the elite is moving toward Sublime Text, persuade himself and try to persuade others that Vim is too old and, finally, switch.

The two trends are slightly overlapping because a few Bobs are going to turn into Alices along the way. Thankfully, because who wants Bobs in his community?

For the record, I'm a Bob turned Alice.


I came to vim as an Alice. Everyone swore by vim, so I thought I should learn it, despite it being kinda fiddly for a text editor. It took me another couple of years to switch over completely, a couple more before I started to actually enjoy using it, and a couple more before I started to care about being efficient with my keystrokes.

Once you drink the cool-aid, there's nothing quite like it. Sometimes I think that scooting around a text file in vim is my favorite thing about coding.


Meh, I knew the days of tax free internet purchases would end some day.


Looks great, but the price is exorbitantly high for a large number of users :(


The target demographic for this product does not feel that way :)


GH pricing is on-par with other enterprise VCS offerings.

Kind of disappointing really, having "cheaper than XYZ" is a nice feature to sell to management.


If you're competing on "awesome", being cheaper isn't an advantage, and also damages the brand.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: