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).
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.
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
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?
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).
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.
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.
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?
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.
You can get your API key here https://platform.openai.com/account/api-keys.