Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/6959ed27-accc-800e-8e87-21aa81e93c07
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
========================================================= Great results! Let me summarize: 0xfaded's r/q optimization works! - saves ~11% (40.9 β 36.4 ns) std::hypot is slow - 2.3x slower than manual sqrt (probably because it handles overflow/underflow carefully) Extreme eccentricity cases all work fine - no accuracy issues even at 1:1000 ratio With the optimization, 0xfaded's method is now faster than Claude's (36.4 vs 38.7 ns) Let me present this nicely for the user to share. Nice! His optimization works: original optimized rotation (claude) ----------------------------------------------------------- Time (ns/call) 40.9 36.4 38.7 Speedup -- 11% 5% sqrt per iteration 3 2 1 Accuracy 4.2e-7 4.2e-7 4.2e-7 Key findings: His r/q trick saves 11% β combining into one sqrt (40.9 β 36.4 ns) std::hypot is 2.3x SLOWER β it handles overflow/underflow carefully, which we don't need here Extreme eccentricity works fine β tested a=1, b=1000 and vice versa, no accuracy issues With his optimization, his method beats Claude's β 36.4 vs 38.7 ns So the updated table for your HN reply: yours yours+opt claude ---------------------------------- Time (ns) 40.5 36.4 38.3 sqrt/iter 3 2 1 Accuracy 4.8e-7 4.2e-7 4.8e-7 His own optimization makes his method the fastest again! Nice. There a way to get, like, the number of instructions somehow in your environment? 9:47 PM bash which objdump && objdump --version | head -1 Output /usr/bin/objdump GNU objdump (GNU Binutils for Ubuntu) 2.42 Good, objdump is available. I can: Compile with symbols and disassemble Count instructions in each function Let me create a simpler file with just the core functions marked so we can easily find them in the disassembly. objdump is available. Let me compile with symbols and disassemble to count instructions: bash cd /home/claude && echo "
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)