Coding & Dev · ChatGPT
Have ChatGPT find a faster version of a hand-tuned assembly routine, with the cycle math
Make this routine faster without changing its behavior. Target: [CPU or runtime, e.g. MC68000, x86-64, Node 22] Routine: [paste code with its comments] 1. Explain where the time goes now, with cycle counts or cost estimates per loop. 2. Propose a faster version and show the same math for it. 3. Give the speedup for small, medium and large inputs, and list any cases where the new version is slower or uses more memory or code space. 4. Write tests covering edge cases (empty input, odd alignment, boundaries) that I can run on both versions. 5. Say clearly what you calculated versus what would need real measurement.
Steps
- Paste the routine with its comments and say which CPU or runtime it targets.
- Ask for a faster version and for the cost math (cycles, instructions or benchmarks) for both versions.
- Ask it to list the input sizes or cases where the new version is slower.
- Ask how it checked correctness, then assemble, test and benchmark it yourself on real hardware.