Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Project Euler and Software Optimization (Problem 4 & Palindromes)

#2
Quote:Someone else did another deep dive into this very same problem, and posted their findings and code.
Based rustposter.
A friend lent me a book on it a month ago or so, it's incredible how fast LLVM can be compared to C, in a few tests I've found that it compiles even better than C.
That being said, if you do want to make it extremely fast, then you also need to wrap everything in unsafe{} which scares the shit out of every rust developer.

Cool that you added concurrency though. I was never able to get a good grasp of that, especially when trying to make everything asynchronous. Spawning threads that do stuff was the easy part, but making sure they didn't interfere with each other was a whole other issue. To be fair I only really ever did try in C++ and Java, both of which seemed a lot more complicated than what Python does here.

Do you reckon that removing all the time benchmarking would improve performance at all? I know that most of it's just fetching values and doing arithmetic, but you do it in each call to palindromes() and main() which I'm assuming would add up to a lot of extra instructions. Perhaps remove them and just run the script in the linux 'time' pipeline?
Code:
time python script.py
Something like that.

Otherwise, your optimization is probably as good as it's gonna get. Then again, I'm no math major, but it seems there's a lot less of a pattern for finding palindromes than, say, finding prime numbers.
Reply


Messages In This Thread
RE: Project Euler and Software Optimization - by Lain - February 12th, 2020 at 5:25 AM
RE: Project Euler and Software Optimization - by Darth-Apple - February 12th, 2020 at 5:37 AM
RE: Project Euler and Software Optimization - by Lain - February 12th, 2020 at 6:21 AM
RE: Project Euler and Software Optimization - by Darth-Apple - February 12th, 2020 at 7:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Optimization and You Lain 6 5,623 September 25th, 2019 at 5:46 PM
Last Post: SpookyZalost



Users browsing this thread: 1 Guest(s)

Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2024
Forum design by Makestation Team © 2013-2024